简体   繁体   中英

problem with win 32 API programming

i just tried to compile and run a simple example which was found on Programming Windows - Win32 API by Charles Petzold here is the code :

#include <windows.h>
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
MessageBox (NULL, TEXT ("Hello, Windows!"), TEXT ("HelloMsg"), 0) ;
return 0 ;
}

and i got the following error :

Error   1   error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup   MSVCRTD.lib(crtexe.obj)

i am using Visual Studio 2010 on Windows 7. how to solve this problem?

is it because i am running some outdated piece of code in new OS if the win32 API for Windows 7 has been changed can anybody suggest me any resources to learn about win32 API for windows 7 with C/C++ or even assembly

There's no doubt this is a duplicate question but i'll answer anyway.

You have created the wrong project type. You need to create a Win32 Project not a Win32 Console Application .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM