I'm getting a weird linker error when trying to compile against a VS2005 CRT with a Visual Studio 2015 toolset.
The same code compiles perfect on any other toolset version (2005,2010,2012,2013).
The code must compile under VS2005 CRT to properly link with other projects.
How to reproduce: Create a new empty Dynamic Library (dll) project (In VS2015, toolset v140), add a source (.cpp) file:
//1.cpp
#include <string>
static std::wstring thisWillFail[] = { L"test" };
Change the VC++ include directories and Library directories to:
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\atlmfc\include
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\include
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\lib
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\atlmfc\lib
C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Lib
Then just compile, an you will get this error:
1>StdAfx.obj : error LNK2019: unresolved external symbol "void __stdcall `eh vector destructor iterator'(void *,unsigned int,unsigned int,void (__thiscall*)(void *))" (??_M@YGXPAXIIP6EX0@Z@Z) referenced in function "void __cdecl `dynamic atexit destructor for 'fasdfp''(void)" (??__Ffasdfp@@YAXXZ)
Same will happen if you set the library and include paths to the VS2010 CRT and Windows SDK.
So, why is VS2015 generating this extra function? And most importantly how can i work around this?
The same linker error appears on every static member i have, and a similar one for several classes.