error LNK2019

2026-02-16 08:10:30

1、1. 当程序的main函数是

  int main(){}

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

2、2. 当程序的main函数是

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

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

3、主要是因为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

(以上文字摘自www.vcerror.com)

猜你喜欢