libcpmt.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ) already defined in msvcprt.lib(MSVCP60.dll)
libcpmt.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ) already defined in msvcprt.lib(MSVCP60.dll)MSVCRT.lib(MSVCRT.dll) : error LNK2005: _localtime already defined in LIBCMT.lib(localtim.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _time already defined in LIBCMT.lib(time.obj)msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Copy(unsigned int)" (?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXI@
Z) already defined in AlarmAdapter.obj
libcpmt.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ) already defined in msvcprt.lib(MSVCP60.dll)MSVCRT.lib(MSVCRT.dll) : error LNK2005: _localtime already defined in LIBCMT.lib(localtim.obj)
MSVCRT.lib(MSVCRT.dll) : error LNK2005: _time already defined in LIBCMT.lib(time.obj)msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "private: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Copy(unsigned int)" (?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEXI@
Z) already defined in AlarmAdapter.obj
这个错误是微软设计错误,因此如果遇到这个错误,我们只能躲过这个链接错误。具体的办法
就是将那个提示出错的库放到另外一个库的前面。另外选择不同的C函数库,可能会引起这个
错误。MS, C有两种C函数库,一种是普通的函数库:LIBC.LIB,不支持多线程。另外一种是
支持多线程的:msvcrt.lib。如果一个工程里,这两种函数库混合使用,可能会引起这个错误。
因此建议使用支持多线程的msvcrt.lib。 需要注意的是,当使用其他的库的时候最容易产生这种错误,例如boost和wxWindow使用/MD来
编译的,也就是使用支持多线程的C函数库。这时候如果自己的程序没有指明/MD的话,就会
提示两种C函数冲突,并且还有LNK2005错误。因此如果使用boost,wxWindow的话,需要指明/MD。错误参考:
http://community.csdn.net/Expert/topic/3482/3482715.xml?temp=.4853632
http://community.csdn.net/Expert/topic/3540/3540700.xml?temp=.1593744
http://search.csdn.net/Expert/topic/2143/2143307.xml?temp=5.834597E-02参考:
http://support.microsoft.com/default.aspx?scid=kb;en-us;q148652
http://blog.csdn.net/enoloo/archive/2004/10/01/122803.aspx
http://www.donews.net/xzwenlan/archive/2004/12/23/211668.aspx
The given symbol was a packaged function (created by compiling with /Gy) and was included in more than one file but was changed between compilations. Recompile all files that include the symbol.
The given symbol was defined differently in two member objects in different libraries, and both member objects were used.
An absolute was defined twice, with a different value in each definition.
选择一种统一的runtime library