0
点赞
收藏
分享

微信扫一扫

VC++报错: LNK2019 unresolved external symbol main referenced in function “int __cdecl invoke_main(v


学习Windows API编程,跑Hello World报错:

 LNK2019    unresolved external symbol main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)    WinAPI_demo    C:\Users\77375\source\repos\WinAPI_demo\WinAPI_demo\MSVCRTD.lib(exe_main.obj)    1   

代码很简单:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpcmdLine, int nCmdShow)
{
	MessageBox(NULL, TEXT("Hello Worlds"), TEXT("My First Application"), MB_OK);
	return 0;
}

网上查询得知,是Linker的设置有问题:

项目右击 > 属性 > Linker > System > SubSystem,

当前设成了CONSOLE,改成Windows即可。

VC++报错: LNK2019 unresolved external symbol main referenced in function “int __cdecl invoke_main(v_#include

重新build成功,可以运行:

VC++报错: LNK2019 unresolved external symbol main referenced in function “int __cdecl invoke_main(v_#include_02

参考:"Unresolved external "int __cdecl invoke_main(void)" after VS2017 15.6.1 update" -- Part 2 - Microsoft Q&A

举报

相关推荐

0 条评论