I'm trying to setup a working toolchain for the Microsoft Visual C++ Compiler in Eclipse with WxWidgets support.
What I did so far is:
Compiling WxWidgets using the distributed Visual Studio .sln for VS2010 (I think Eclipse uses the same compiler etc.)
Confirm Eclipse toolchain is working (Standard Hello World project)
Create WxWidgets test application (Zetcode Tutorial)
Configure Eclipse toolchain with appropriate include path, library path, preprocessor macros (_WXDEBUG__ WIN32 _WINDOWS wxUSE_GUI=1 _UNICODE UNICODE _DEBUG _WIN32_WINNT=0x0502 _WXMSW__ _WIN32) and code generation set to /MT or /MTd depending on debug or release build.
I specified additional libraries ( wxmsw30ud_core.lib wsock32.lib winmm.lib comctl32.lib rpcrt4.lib wxexpatd.lib wxjpegd.lib wxpngd.lib wxregexud.lib wxscintillad.lib wxtiffd.lib wxzlibd.lib Version.lib opengl32.lib glu32.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 ) according to this guide
and now I end up with a Linker Error (LNK2005) on msvcrtd.lib and msvcprtd.lib.
For example:
msvcprtd.lib(MSVCP100D.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) ist bereits in libcpmtd.lib(xthrow.obj) definiert.
I am aware of the "change code generation setting to /MTd" fix, but I already use that setting and I checked the WxWidgets build configuration to specify a static library, unicode build.
So has anybody any idea why the linker comes up with that error?
Many thanks in advance.
"Static" in wxWidgets build means just that wxWidgets is built as a static library and not a DLL. It still uses CRT DLLs by default. If you use the project files, you will need to multi-select all projects in them and change the corresponding option. Alternatively, you can build from command line using nmake, then it's enough to specify RUNTIME_LIBS=static
as explained here.