Archived

This topic is now archived and is closed to further replies.

sarkath

vc++ (6.0) odd compilation messages

Recommended Posts

sarkath    122
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

Share this post


Link to post
Share on other sites
Sand_Hawk    108
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.

Share this post


Link to post
Share on other sites
Fruny    1658
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...

Share this post


Link to post
Share on other sites
penguin    109
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


Share this post


Link to post
Share on other sites