Advertisement

vc++ (6.0) odd compilation messages

Started by April 29, 2002 05:44 PM
2 comments, last by sarkath 22 years, 6 months ago
Right now vc++ is weirding out on me... now all the sudden i cant even make a console application without it screaming "LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16" and "Debug/t13.exe : fatal error LNK1120: 1 unresolved externals" I mean... what does WinMain have to do with a console application ? I understand nada and right now I cant even program anything cuz im stuck even with this code below it fails. #include <iostream.h> main() { cout << "hello world"; return true; } Just take my out on the street and shoot me
Here we go again:

Unresolved Externals are function that you prototyped but did not declare. E.g. you do this on top of your code:

int FooBar(int X, int Y);

but never declare the body of the statement. For the compiler the functions exists by prototyping but the linker can''t find the object code for the function. Check the function name and see if you declared it.

Sand Hawk


----------------
-Earth is 98% full. Please delete anybody you can.
----------------(Inspired by Pouya)
Advertisement
a) Don''t ever use iostream.h. Use iostream and using namespace std instead.

b) You told your compiler to make a windowed application (entry point WinMain) and built a console application (entry point main). Go to your project settings and change the option /subsystem:windows to /subsystem:console.

[Questions (STFW) | GDNet Start Here | GDNet Search | Forum FAQ | Google | Asking Smart Questions ]
[Docs (RTFM) | MSDN | SGI''s STL | OpenGL | File formats]
[C++ Must Haves (RTFS) | MinGW | Boost | Loki | FLTK | SDL ]

Stolen from Magmai Kai Holmlor, who held it from Oluseyi, who was inspired by Kylotan...
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
you created a win32 application project.
you have to choose the win32 console project.

the reason behind this is when you choose a win32 application, the compiler thinks your creating a win32 application with the win32 api, so it naturally looks for the WinMain. But DOS does not use WinMain, so it gets confused and refuses to compile.
Create a Console Project

CFO Wretched Penguin Entertainment


This topic is closed to new replies.

Advertisement