C++ Visual Studio 2010 x64 上的链接错误
我正在将 C++ 代码库从 VS2005 升级到 VS2010,并且正在重建一些第三方 C++ 依赖项。我构建这些 32 位没有问题,但在链接 64 位 (x64) 时不断遇到问题。我遇到了许多标准库函数未解决的外部问题。例如:
error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (__imp_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@XZ)
error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@PEBD@Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl YAML::Exp::Escape(class YAML::Stream &,int)" (?Escape@Exp@YAML@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAVStream@2@H@Z)
我尝试将 msvcprtd.lib 显式添加到链接行并启用库解析调试,它似乎正在搜索 C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\msvcprtd.lib 的符号但没有找到他们。
任何人都知道为什么会发生这种情况?
I'm upgrading a C++ code base from VS2005 to VS2010 and I'm rebuilding some third party C++ dependencies. I have no problem building these 32-bit but keep running into problems linking 64-bit (x64). I'm getting unresolved externals for a number of standard library functions. For example:
error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (__imp_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@XZ)
error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (__imp_??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@PEBD@Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl YAML::Exp::Escape(class YAML::Stream &,int)" (?Escape@Exp@YAML@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAVStream@2@H@Z)
I tried explicitly adding msvcprtd.lib to the link line and enabled library resolution debugging and it appears to be searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64\msvcprtd.lib for symbols but is not finding them.
Anyone have any idea why this is happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试启用 /showIncludes 以查看引入了哪些头文件。因为一般来说,我希望这些函数能够内联到生成的二进制文件中。
You might try enabling /showIncludes to see what header files are being brought in. Because in general I would expect those functions to be inlined into your resulting binary.