问题
I converted a perfectly working Managed C++ DLL project that uses Unmanaged C++ LIBs from VS2008 to VS2010. Beforehand I separately rebuilt the LIBs with VS2010 (they are part of another project that I have no authority over). However, after conversion my managed DLL project stopped linking giving me few dosen of LNK2001 error messages (see the sample below). All errors about "std" entities defined within "string" and "iosfwd" headers. Which compiler/linker settings am I missing?
Thanks in advance for your help.
Auxiliary.lib(Error.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) bool __cdecl std::operator!=<char,struct std::char_traits<char>,class td::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,char const *)" (__imp_??$?9DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PEBD@Z)
Auxiliary.lib(Error.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z)
Auxiliary.lib(Error.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static unsigned __int64 const std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::npos" (__imp_?npos@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@2_KB)
Auxiliary.lib(Error.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (__imp_?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ)
Auxiliary.lib(Error.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void)" (__imp_?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ)
Auxiliary.lib(Error.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::str(void)const " (__imp_?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ)
Auxiliary.lib(Error.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl std::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >::basic_ostringstream<char,struct std::char_traits<char>,class std::allocator<char> >(int)" (__imp_??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z)
Auxiliary.lib(Error.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::substr(unsigned __int64,unsigned __int64)const " (__imp_?substr@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV12@_K0@Z)
etc...
回答1:
Finally found it (thanks Hans Passant for the tip!) I had a few files that were still built by VS2008 and that caused the issue. Thanks to everyone who bothered to add a comment.
来源:https://stackoverflow.com/questions/7525256/c-cli-dll-project-stops-linking-after-conversion-from-vs2008-to-vs2010