VS2005 msvcprtd.lib(MSVCP80D.dll) : error LNK2005

  1. VS2005 msvcprtd.lib(MSVCP80D.dll) : error LNK2005

VS2005 msvcprtd.lib(MSVCP80D.dll) : error LNK2005

原文連結: https://darkblack01.blogspot.com/2014/08/vs2005-msvcprtdlibmsvcp80ddll-error.html
移植時的最後更新日期: 2015-12-23T14:16:57.670+08:00

編譯完出現下面的訊息

1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: “public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)” (??1?basicstring@DU?basic_string@DU?char_traits@D@std@@V?allocator@D@2@@std@@QAE@XZ) 已在 cppUnitMain.obj 中定義過了

1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?basic_string@DU?chartraits@D@std@@V?char_traits@D@std@@V?allocator@D@2@@std@@QAE@ABV01@@Z) 已在 cppUnitMain.obj 中定義過了

1>msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::c_str(void)const " (?c_str@?basicstring@DU?basic_string@DU?char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) 已在 cppUnitMain.obj 中定義過了

1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: “private: __thiscall type_info::type_info(class type_info const &)” (??0type_info@@AAE@ABV0@@Z) 已在 LIBCMT.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) 已在 LIBCMT.lib(typinfo.obj) 中定義過了
1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: “public: virtual __thiscall std::exception::~exception(void)” (??1exception@std@@UAE@XZ) 已在 LIBCMT.lib(stdexcpt.obj) 中定義過了

1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: “public: __thiscall std::exception::exception(class std::exception const &)” (??0exception@std@@QAE@ABV01@@Z) 已在 LIBCMT.lib(stdexcpt.obj) 中定義過了
1>MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: “public: __thiscall std::exception::exception(void)” (??0exception@std@@QAE@XZ) 已在 LIBCMT.lib(stdexcpt.obj) 中定義過了

1>LINK : warning LNK4098: 預設的程式庫 ‘MSVCRTD’ 與其他使用的程式庫衝突,請使用 /NODEFAULTLIB:library


[1] 只要把編譯的RTTI打開就可以解決了!
[2] vs2005 專案檔設定>C/C++>Code Generation>RunTime Library,選Muti-threaded Debug DLL(參考)

參考資料:
[1] How to resolve linking error?
[2] VS2005中運行時庫不一致導致項目編譯出問題