您的位置:首页 > 其它

error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”

2015-07-09 00:28 836 查看
今日VS2012 C++编译出现一堆错误:

1>  正在生成代码...
1>Code.obj : error LNK2005: "public: __thiscall std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP110D.dll) 中定义
1>Code.obj : error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP110D.dll) 中定义
1>Code.obj : error LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) 已经在 msvcprtd.lib(MSVCP110D.dll) 中定义
1>IOCP_Socket.lib(CLog.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”(Code.obj 中)
1>IOCP_Socket.lib(TcpServer.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”(Code.obj 中)
1>IOCP_Socket.lib(stdafx.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”(Code.obj 中)
1>IOCP_Socket.lib(TcpSrvException.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”(Code.obj 中)
1>IOCP_Socket.lib(TcpReceiveContext.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”(Code.obj 中)
1>IOCP_Socket.lib(TcpSendContext.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”(Code.obj 中)
1>IOCP_Socket.lib(AcceptContext.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”(Code.obj 中)
1>IOCP_Socket.lib(OperateContext.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”(Code.obj 中)
1>IOCP_Socket.lib(MemoryBlock.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”(Code.obj 中)
1>IOCP_Socket.lib(ContextStack.obj) : error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”(Code.obj 中)
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) 已经在 libcpmtd.lib(stdthrow.obj) 中定义
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::_Container_base12(void)" (??0_Container_base12@std@@QAE@XZ) 已经在 Code.obj 中定义
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::_Container_base12::~_Container_base12(void)" (??1_Container_base12@std@@QAE@XZ) 已经在 Code.obj 中定义
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: void __thiscall std::_Container_base12::_Orphan_all(void)" (?_Orphan_all@_Container_base12@std@@QAEXXZ) 已经在 Code.obj 中定义
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc@std@@YAXXZ) 已经在 libcpmtd.lib(xthrow.obj) 中定义
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "void __cdecl std::_Xlength_error(char const *)" (?_Xlength_error@std@@YAXPBD@Z) 已经在 libcpmtd.lib(xthrow.obj) 中定义
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "void __cdecl std::_Xout_of_range(char const *)" (?_Xout_of_range@std@@YAXPBD@Z) 已经在 libcpmtd.lib(xthrow.obj) 中定义
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "char const * __cdecl std::_Syserror_map(int)" (?_Syserror_map@std@@YAPBDH@Z) 已经在 libcpmtd.lib(syserror.obj) 中定义
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "char const * __cdecl std::_Winerror_map(int)" (?_Winerror_map@std@@YAPBDH@Z) 已经在 libcpmtd.lib(syserror.obj) 中定义
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) 已经在 libcpmtd.lib(xlock.obj) 中定义
1>msvcprtd.lib(MSVCP110D.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) 已经在 libcpmtd.lib(xlock.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _memmove 已经在 LIBCMTD.lib(memmove.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fclose 已经在 LIBCMTD.lib(fclose.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fflush 已经在 LIBCMTD.lib(fflush.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _printf 已经在 LIBCMTD.lib(printf.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _vprintf 已经在 LIBCMTD.lib(vprintf.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __vsnprintf_s 已经在 LIBCMTD.lib(vsnprnc.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _vsprintf_s 已经在 LIBCMTD.lib(vsnprnc.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __invalid_parameter 已经在 LIBCMTD.lib(invarg.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _memcpy_s 已经在 LIBCMTD.lib(memcpy_s.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _strncpy_s 已经在 LIBCMTD.lib(strncpy_s.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) 已经在 LIBCMTD.lib(stdexcpt.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: "public: virtual char const * __thiscall std::exception::what(void)const " (?what@exception@std@@UBEPBDXZ) 已经在 LIBCMTD.lib(stdexcpt.obj) 中定义
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __CrtDbgReportW 已经在 LIBCMTD.lib(dbgrptw.obj) 中定义
1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) 已经在 LIBCMTD.lib(typinfo.obj) 中定义
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) 已经在 LIBCMTD.lib(typinfo.obj) 中定义
1>LINK : warning LNK4098: 默认库“MSVCRTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library
1>E:\Projects\C++\IOCP_Socket\Debug\Test.exe : fatal error LNK1169: 找到一个或多个多重定义的符号
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========


后来查了下,是运行库设置的问题; 几个工程的 运行库设置不一样了:

项目属性 -> 配置属性 -> C/C++ -> 代码生成 -> 运行库

都设置一样就行了 多线程调试(/MTd)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: