因为项目需要,开始学习windows下的应用程序的编写
刚才写了个简单的测试程序
#include <windows.h>
int WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL,
TEXT("开始学习Windows编程"),
TEXT("消息对话框"),
MB_OK);
return 0;
}
运行的时候报错如下
--------------------Configuration: VerifyDS - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/VerifyDS.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
VerifyDS.exe - 2 error(s), 0 warning(s)
后来上网查了下,解决方法如下:
Windows项目要使用Windows子系统, 而不是Console, 可以这样设置: *^'y#/Dg
z !DF-%3|
[Project] --> [Settings] --> 选择"Link"属性页, Qo!
在Project Options中将/subsystem:console改成/subsystem:windows