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<开发者_StackOverflow中文版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?
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.
精彩评论