简体   繁体   English

Win 32 API编程的问题

[英]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 : 我只是尝试编译并运行一个简单的示例,该示例在Charles Windows的编程Windows-Win32 API中找到,代码如下:

#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? 我在Windows 7上使用Visual Studio2010。如何解决此问题?

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 是因为如果Windows 7的win32 API已更改,我正在新操作系统中运行一些过时的代码,有人可以建议我任何资源来学习Windows 7的C / C ++甚至汇编语言的win32 API。

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 . 您需要创建一个Win32 Project而不是Win32 Console Application

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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