C++ Visual Studio 2010 x64 上的链接错误

发布于 2024-09-11 07:12:56 字数 1346 浏览 1 评论 0原文

我正在将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泼猴你往哪里跑 2024-09-18 07:12:56

您可以尝试启用 /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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文