当我尝试构建它时,我的应用程序给了我一个链接错误。
Error 5 error LNK2001: unresolved external symbol "int __cdecl _AfxInitManaged(void)" (?_AfxInitManaged@@YAHXZ) mfcs80ud.lib
我正在使用Visual Studio 2005构建应用程序。如果这有帮助,我还会针对Server 2003和Windows 6.1 SDK连接WINDDK。
我用Google搜索并注意到人们说它是预编译的头问题,应该通过在/Yc
创建/使用预编译头属性中设置stdafx.cpp
开关来修复它。但这并没有为我解决,我也不确定如何解决这个问题。
有人可以帮忙吗。
答案 0 :(得分:0)
一旦我重新启动机器,它似乎解决了它自己...不确定是什么原因导致它,甚至重新启动VS并清理解决方案无数次无效。
答案 1 :(得分:0)
我在Visual Studio 2010中遇到了同样的问题
error LNK2001: unresolved external symbol "int __cdecl _AfxInitManaged
事实证明,这是我的错误,在其他项目中包含另一个stdafx.cpp
包含多个stdafx.cpp会产生这种症状。
答案 2 :(得分:0)
使用Visual Studio 2005构建.NET 2003解决方案,我遇到了描述的LNK2001错误。该项目没有stdafx.cpp文件。我向项目添加了stdafx.cpp的副本,并成功构建了该文件。