[Solved] error LNK2038: Detected mismatch of “RuntimeLibrary”: The value “MDd_DynamicDebug” does not match the value “MTd_StaticDebug”

A bunch of errors appeared in VS2012 C++ compilation today:

1  1 >   Code generation...
 2  1 >Code.obj: error LNK2005: " public: __thiscall std::_Container_base12::_Container_base12(void) " (?? 0_Container_base12@std@@QAE@XZ) is already in msvcprtd. Defined in lib(MSVCP110D.dll)
 3  1 >Code.obj: error LNK2005: " public: __thiscall std::_Container_base12::~_Container_base12(void) " (?? 1_Container_base12@std@@QAE@XZ) is already in msvcprtd. Defined in lib(MSVCP110D.dll)
 4  1 >Code.obj: error LNK2005: " public: void __thiscall std::_Container_base12::_Orphan_all(void) " (?_Orphan_all@_Container_base12@std@@QAEXXZ) has been defined in msvcprtd.lib(MSVCP110D.dll)
 5  1 > IOCP_Socket.lib(CLog.obj): error LNK2038: mismatch detected for "RuntimeLibrary": value "MDd_DynamicDebug" Mismatched value "MTd_StaticDebug" (in Code.obj)
 6  1 > IOCP_Socket.lib(TcpServer.obj): error LNK2038: mismatch detected for "RuntimeLibrary": The value "MDd_DynamicDebug" does not match the value "MTd_StaticDebug" (Code. obj)
 7  1 > IOCP_Socket.lib(stdafx.obj): error LNK2038: mismatch detected for "RuntimeLibrary": The value "MDd_DynamicDebug" does not match the value "MTd_StaticDebug" (Code.obj)
 8  1 > IOCP_Socket.lib (TcpSrvException.obj): error LNK2038: mismatch detected for "RuntimeLibrary": The value "MDd_DynamicDebug" does not match the value "MTd_StaticDebug" (in Code.obj)
 9  1> IOCP_Socket.lib(TcpReceiveContext.obj): error LNK2038: mismatch detected for "RuntimeLibrary": The value "MDd_DynamicDebug" does not match the value "MTd_StaticDebug" (in Code.obj)
 10  1 > IOCP_Socket.lib(TcpSendContext.obj) : error LNK2038: mismatch detected for "RuntimeLibrary": The value "MDd_DynamicDebug" does not match the value "MTd_StaticDebug" (Code.obj)
 11  1 > IOCP_Socket.lib(AcceptContext.obj): error LNK2038: "RuntimeLibrary" detected Mismatch for: value "MDd_DynamicDebug" does not match value "MTd_StaticDebug" (in Code.obj)
 12  1 > IOCP_Socket.lib(OperateContext.obj): error LNK2038: mismatch detected for "RuntimeLibrary": value "MDd_DynamicDebug" Does not match the value "MTd_StaticDebug" (in Code.obj)
 13  1 >IOCP_Socket.lib(MemoryBlock.obj): error LNK2038: mismatch detected for "RuntimeLibrary": The value "MDd_DynamicDebug" does not match the value "MTd_StaticDebug" (in Code.obj)
 14  1 > IOCP_Socket.lib(ContextStack.obj): error LNK2038: mismatch detected for "RuntimeLibrary": The value "MDd_DynamicDebug" does not match the value "MTd_StaticDebug" (in Code.obj)
 15  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " void __cdecl std:: _Debug_message(wchar_t const *,wchar_t const *,unsigned int) " (? _Debug_message@std@@YAXPB_W0I@Z) has been defined in libcpmtd.lib(stdthrow.obj)
 16  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " public: __thiscall std::_Container_base12::_Container_base12(void) " (??0_Container_base12@std@@QAE@XZ) has been defined in Code.obj
 17  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " public: __thiscall std::_Container_base12::~_Container_base12(void) " (?? 1_Container_base12@std@@QAE@XZ) has been defined in Code.obj
 18  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " public: void __thiscall std::_Container_base12::_Orphan_all(void) " (? _Orphan_all @_Container_base12@std@@QAEXXZ) has been defined in Code.obj
 19  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " void __cdecl std::_Xbad_alloc(void) " (?_Xbad_alloc@std@@YAXXZ) has been defined in libcpmtd.lib(xthrow.obj)
 20  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " void __cdecl std::_Xlength_error(char const *) " (? _Xlength_error @std@@YAXPBD@Z) has been defined in libcpmtd.lib(xthrow.obj)
 21  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " void __cdecl std::_Xout_of_range(char const *) " (? _Xout_of_range@std@@YAXPBD@Z) has been defined in libcpmtd.lib(xthrow.obj)
 22  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " char const * __cdecl std::_Syserror_map(int) " ( ?_Syserror_map@std@@YAPBDH@Z) has been defined in
 libcpmtd.lib(syserror.obj) 23  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " char const * __cdecl std::_Winerror_map(int) " ( ? _Winerror_map@std@@YAPBDH@Z) has been defined in
 libcpmtd.lib(syserror.obj) 24  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " public: __thiscall std::_Lockit::_Lockit(int ) " (?? 0_Lockit@std@@QAE@H@Z) has been defined in libcpmtd.lib(xlock.obj)
 25  1 >msvcprtd.lib(MSVCP110D.dll): error LNK2005: " public: __thiscall std:: _Lockit::~_Lockit(void) " (??1_Lockit@std@@QAE@XZ) is already defined in libcpmtd.lib(xlock.obj)
 26  1 > MSVCRTD.lib(MSVCR110D.dll): error LNK2005: _memmove is already defined in LIBCMTD.lib(memmove.obj)
 27  1 > MSVCRTD.lib(MSVCR110D.dll): error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
 28  1 > MSVCRTD.lib(MSVCR110D.dll): error LNK2005: _fflush already defined in LIBCMTD.lib(fflush .obj)
 29  1 > MSVCRTD.lib(MSVCR110D.dll): error LNK2005: _printf already defined in LIBCMTD.lib(printf.obj)
 30  1 > MSVCRTD.lib(MSVCR110D.dll): error LNK2005: _vprintf already defined Defined in LIBCMTD.lib(vprintf.obj)
 31  1 >MSVCRTD.lib(MSVCR110D.dll): error LNK2005: __vsnprintf_s already defined in LIBCMTD.lib(vsnprnc.obj)
 32  1 > MSVCRTD.lib(MSVCR110D.dll): error LNK2005: _vsprintf_s already defined in LIBCMTD.lib(vsnprnc.lib(vsnprnc) ) Defined in
 33  1 > MSVCRTD.lib(MSVCR110D.dll): error LNK2005: __invalid_parameter is already defined in LIBCMTD.lib(invarg.obj)
 34  1 > MSVCRTD.lib(MSVCR110D.dll): error LNK2005: _memcpy_s is already defined in LIBCMTD .lib(memcpy_s.obj) is defined in
 35  1 > MSVCRTD.lib(MSVCR110D.dll): error LNK2005: _strncpy_s is already defined in LIBCMTD.lib(strncpy_s.obj)
 36  1 >MSVCRTD.lib(MSVCR110D.dll): error LNK2005: "public: virtual __thiscall std::exception::~exception(void) " (?? 1exception@std@@UAE@XZ) has been defined in LIBCMTD.lib(stdexcpt.obj)
 37  1 >MSVCRTD.lib(MSVCR110D.dll ): error LNK2005: " public: virtual char const * __thiscall std::exception::what(void)const " (? what@exception@std@@UBEPBDXZ) is already defined in LIBCMTD.lib(stdexcpt.obj)
 38  1 > MSVCRTD.lib(MSVCR110D.dll): error LNK2005: __CrtDbgReportW is already defined in LIBCMTD.lib(dbgrptw.obj)
 39  1 >MSVCRTD.lib(ti_inst.obj): error LNK2005: " private: __thiscall type_info::type_info( class type_info const &) " (??0type_info@@AAE@ABV0@@Z) is already defined in LIBCMTD.lib(typinfo.obj)
 40  1 >MSVCRTD.lib(ti_inst.obj): error LNK2005: " private: class type_info & __thiscall type_info::operator=( class type_info const &) " (?? 4type_info@@AAEAAV0@ABV0@@Z) has been defined in LIBCMTD.lib(typinfo.obj)
 41  1 >LINK: warning LNK4098: The default library "MSVCRTD" conflicts with the use of other libraries ;Please use / NODEFAULTLIB:library
 42  1 >E:\Projects\C++ \IOCP_Socket\Debug\Test.exe: fatal error LNK1169: Found one or more multiple defined symbols
 43 ========== Generate : Success 0 , failure 1 , 0 latest , skip 0 ==========

Later, I checked it and found that it was a problem with the runtime library settings; the runtime library settings for several projects were different:

Project Properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library

We are set on the line, like multi-threaded debugging (/ MTd)

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *