There is a bug in the Visual Studio 2010 header <msclr/marshal.h>
.
There is written
#pragma comment(lib, "comsupp.lib")
but compared to <comdef.h>
there must be written
#ifdef _NATIVE_WCHAR_T_DEFINED
# ifdef _DEBUG
# pragma comment(lib, "comsuppwd.lib")
# else
# pragma comment(lib, "comsuppw.lib")
# endif
#else
# ifdef _DEBUG
# pragma comment(lib, "comsuppd.lib")
# else
# pragma comment(lib, "comsupp.lib")
# endif
#endif
See also the Lib-section in https://learn.microsoft.com/de-de/cpp/cpp/set-com-error-handler?view=vs-2019
So you have 2 Options
- BAD: Edit the
msclr/marshal.h
in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\msclr\marshal.h
. But then all collegues must change their file too.
- Change the ProjectSetting
Linker
-> Input
-> Ignore Specific Default Libraries
and add commsupp.lib
. !!!But attention if you have set the compiler option /Zc: wchar_t-
(see C/C++
-> Language
-> Treat WChar_t as Built in Type
) AND compiling for Release then it must not be ignored!!! So each project configuration may/must be changed differently.