提问人:Hinchy 提问时间:8/27/2014 最后编辑:Ross RidgeHinchy 更新时间:8/29/2014 访问量:642
将 C++ 项目从 vs2005 移动到 vs2010 的链接器问题
linker issue moving a C++ project from vs2005 to vs2010
问:
我正在尝试将项目从 Visual Studio 2005 转换为 2010。(为 Maya 2014 编写插件,因为它仅是 x64)。
首先,我正在针对Maya 2013 x86使用VS2010进行编译。这种编译和链接在 VS 2005 中工作正常,但在 2010 中,我遇到了大量错误:
error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,char const *,int)" (??3@YAXPAXPBDH@Z) referenced in function __unwindfunclet$?creator@exporter@@SAPAXXZ$0
我在下面附上了生成输出的命令行(为了清楚起见,省略了一些部分)。您会注意到 VS 工具集从 80 到 100(2005 与 2010)不同,并且 2010 链接器中缺少该块。此块是 Visual Studio 在解决方案生成过程中编译的依赖项目列表。{ project libs compiled with VS2005 .sln file }
您知道如何让这些本地构建的库显示在 2010 链接器中吗?我什至应该期待他们吗?谁能建议其他攻击点来解决这个问题?
2005 年 C/C++
/Od /I "C:\Program Files (x86)\Autodesk\Maya2013\include" /I {our engine include} /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "NT_PLUGIN" /D "REQUIRE_IOSTREAM" /D "_WINDLL" /FD /EHsc /MTd /Fp{pch file output} /Fo"Debug_2013\" /Fd"Debug_2013\vc80.pdb" /W3 /nologo /c /Zi /TP /errorReport:prompt
2010 C/C++
/I"C:\Program Files (x86)\Autodesk\Maya2013\include" /I{our engine include} /Zi /nologo /W3 /WX- /Od /Oy- /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "NT_PLUGIN" /D "REQUIRE_IOSTREAM" /D "_WINDLL" /Gm- /EHsc /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /GR /Fp*{pch file output}* /Fa"Debug\" /Fo"Debug\" /Fd"Debug\vc100.pdb" /Gd /TP
/analyze- /errorReport:prompt
2005 链接器
/OUT:{dll output file} /NOLOGO /LIBPATH:"C:\Program Files (x86)\Autodesk\Maya2013\lib" /DLL /MANIFEST /MANIFESTFILE:{manifest output file} /NODEFAULTLIB:"libcmt.lib" /DEBUG /PDB:{pdb file} /MAP /IMPLIB:{import library} /ERRORREPORT:PROMPT Opengl32.lib pnglib_d.lib zlib_d.lib libeay32.lib ssleay32.lib Foundation.lib OpenMaya.lib OpenMayaUI.lib OpenMayaAnim.lib OpenMayaFX.lib OpenMayaRender.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib { project libs compiled with VS2005 .sln file }
/subsystem:windows /dll /incremental:yes /debug /export:initializePlugin /export:uninitializePlugin
2010 链接器
/OUT:{dll output file} /NOLOGO /LIBPATH:"C:\Program Files (x86)\Autodesk\Maya2013\lib" /DLL "Opengl32.lib" "pnglib_d.lib" "zlib_d.lib" "libeay32.lib" "ssleay32.lib" "Foundation.lib" "OpenMaya.lib" "OpenMayaUI.lib" "OpenMayaAnim.lib" "OpenMayaFX.lib" "OpenMayaRender.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /NODEFAULTLIB:"libcmt.lib" /MANIFEST /ManifestFile:{manifest output file} /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:{pdb output file} /MAP /PGD:{pgd output file} /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:PROMPT
/subsystem:windows /dll /debug /export:initializePlugin /export:uninitializePlugin
答:
终于弄清楚了问题所在!!!
遵循“新方式”,Visual Studio 2010 列出了项目依赖项。http://manski.net/2011/11/project-dependencies-in-visual-c/
这解决了“未解决的符号”问题,但产生了以下错误: 错误MSB4006:目标依赖项关系图中存在循环依赖关系
我通过此处的说明解决了这个问题 https://connect.microsoft.com/VisualStudio/feedback/details/534361/better-error-message-for-output-circular-dependency#details
希望这能为某人省去很多麻烦。
评论