Error with WinMain

Started by
4 comments, last by Ahrimal 15 years, 9 months ago
Hi there, im just starting using some examples on the net, and well, first try i make, first errors i get, xD I use this simple code: //hellow world in a window #define WIN32_LEAN_AND_MEAN //trim down the libraries used #include <windows.h> #include <tchar.h> int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR IpCmdLine, int nShowCmd){ MessageBox(NULL,_T("Hello!\n"),_T("Helo Window"),MB_OK); return 0; } And i get this error: error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup As it says, is an linking error but... well im kind of lost... cause don't know what link error can i have. :S If some1 could help me i would be very grateful, ^^
Advertisement
It looks like your code is trying to find a main() function, but you've supplied a WinMain. You need to make sure your project settings are for a windows application and not a console app. What compiler/IDE are you using?
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
I'm using v2008.
lol... yes, i was using a console application, i'm so "clever" ... xD

Thx a lot, xD
What type of project did you create? You have to select a Win32 App to make sure it loads the right dependencies. Also, I know the express version of MSVC++ 2005 did not ship with the windows platform SDK. This is an extra download needed to do windows development. I'm not sure if 2008 comes with it or not.
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
Yep it comes with it, ^^

Well, now that i have a window (hoorray!!) time to see how to handle it, :D

Thx a lot again

This topic is closed to new replies.

Advertisement