MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in funct
本来应该是console application , 我却选择了Windows application (这就是本质原因,但是出错了也不要紧,百度到了一个很好的博客)
链接如下:http://blog.youkuaiyun.com/tianyi1991/article/details/44134641
编译出现:
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
产生此类问题的原因是:
- 当程序的main函数是
int main(){}
这样的写法,system 的SubSystem就是/SUBSYSTEM:CONSOLE - 当程序的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