0

I have a DLL-project that compiles, links and works fine with Visual Studio 6.

Now I have loaded it into Visual Studio 2010. During import of the old .dsp file VS2010 asked me for conversion to .vcxproj file. After that I try to compile the newly converted project but stumble upon this strange linker error in debug build:

error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: struct oapc_bin_head * const & __thiscall std::_Deque_const_iterator<struct oapc_bin_head *,class std::allocator<struct oapc_bin_head *> >::operator*(void)const " (??D?$_Deque_const_iterator@PAUoapc_bin_head@@V?$allocator@PAUoapc_bin_head@@@std@@@std@@QBEABQAUoapc_bin_head@@XZ)

The _DEBUG compile switch is defined in debug mode as well as NDEBUG in release mode. Amazingly in release mode the error is quite different:

error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xlength_error(char const *)" (__imp_?_Xlength_error@std@@YAXPBD@Z) referenced in function "protected: void __thiscall std::deque<struct oapc_bin_head *,class std::allocator<struct oapc_bin_head *> >::_Xlen(void)const " (?_Xlen@?$deque@PAUoapc_bin_head@@V?$allocator@PAUoapc_bin_head@@@std@@@std@@IBEXXZ)

Any ideas what got lost during project file conversion?

Thanks!

Elmi
  • 5,899
  • 15
  • 72
  • 143
  • Does this answer help? http://stackoverflow.com/questions/6003368/unresolved-externals-in-c-when-using-vectors-and-find and this link http://forum.ragezone.com/f728/vs2010-packui-fix-error-lnk2019-784831/ – Amitd Jun 24 '13 at 08:21
  • No, sorry, does not help. _DEBUG is mandatory in debug build, (not only) assert() would not work correctly if it doesn't exists. – Elmi Jun 24 '13 at 08:34
  • Solved at least the debug build problem: Linking has to be done against msvcrtd.lib and not msvcrt.lib – Elmi Jun 24 '13 at 11:21

1 Answers1

0

It looks like you have some sort of problem with linking to the std dll. It can be something like building one of the two in x64 and the other in x86, just not adding the dll to your link or something similar to that.

can you post the linker command the visual studio uses?

asafrob
  • 1,838
  • 13
  • 16
  • /OUT:"../plugins/rtc.dll" /INCREMENTAL /NOLOGO /LIBPATH:".." /DLL "../liboapc/Debug/liboapc.lib" "msvcrt.lib" "Ws2_32.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" /MANIFEST /ManifestFile:".\Debug\rtc.dll.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"F:\demos\Debug\rtc.pdb" /SUBSYSTEM:CONSOLE /PGD:"F:\demos\Debug\rtc.pgd" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\Debug\rtc.lib" /MACHINE:X86 /ERRORREPORT:QUEUE – Elmi Jun 24 '13 at 08:33