MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16

编译出现:

MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

产生此类问题的原因是:

1. 当程序的main函数是

     int main(){}

这样的写法,system 的SubSystem就是/SUBSYSTEM:CONSOLE

2. 当程序的main函数是

     int main(int argc, char* argv[]){}

这样的写法,system 的SubSystem就是/SUBSYSTEM:CONSOLE

主要是因为main函数的入口和subsystem不匹配才会出现上面提及的问题。

结论:

当main函数的入口和subsystem不匹配时,一旦编译就会出现如下问题:

MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup

解决方法:

1、修改main函数

2、重设subsystem参数:

Project -> xxxx Properties -> Configuration Properties -> Linker -> System—>SubSystem

猜你喜欢

转载自zj133520.iteye.com/blog/1544328