编译Caffe时遇到error LNK2005: opencv_core300d.lib已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

35 篇文章 0 订阅
32 篇文章 0 订阅

编译Caffe时遇到error LNK2005: opencv_core300d.lib已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

解决方法:

问题描述(我遇到的问题和这个类似,但不完全一样,解决方法是一样的,用的是方法一):

正在链接…

1>NetFuncLib_d.lib(IpList.obj) : 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?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(IpList.obj) : error LNK2005: “public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(char const *)” (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(IpList.obj) : error LNK2005: “public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)” (??1_Container_base_secure@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(IpList.obj) : error LNK2005: “public: __thiscall std::_Container_base_secure::_Container_base_secure(void)” (??0_Container_base_secure@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(Net.obj) : error LNK2005: “public: unsigned int __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::length(void)const ” (?length@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(Net.obj) : 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> >(char const *)” (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(Net.obj) : 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?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(Net.obj) : 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?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(Net.obj) : error LNK2005: “public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(char const *)” (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(Net.obj) : 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@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(Net.obj) : error LNK2005: “public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)” (??1_Container_base_secure@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(Net.obj) : error LNK2005: “public: __thiscall std::_Container_base_secure::_Container_base_secure(void)” (??0_Container_base_secure@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(HttpHeader.obj) : error LNK2005: “public: unsigned int __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::length(void)const ” (?length@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(HttpHeader.obj) : error LNK2005: “public: __thiscall std::_Container_base_secure::_Container_base_secure(void)” (??0_Container_base_secure@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(HttpHeader.obj) : error LNK2005: “public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)” (??1_Container_base_secure@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(HttpHeader.obj) : 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> >(char const *)” (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(HttpHeader.obj) : 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?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(HttpHeader.obj) : 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?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(HttpHeader.obj) : error LNK2005: “public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::operator=(char const *)” (??4?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV01@PBD@Z) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>NetFuncLib_d.lib(HttpHeader.obj) : 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@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>libcmtd.lib(sprintf.obj) : error LNK2005: _sprintf 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(dbgheap.obj) : error LNK2005: __malloc_dbg 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(dbgheap.obj) : error LNK2005: __free_dbg 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(atox.obj) : error LNK2005: _atoi 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(tidtable.obj) : error LNK2005: __encode_pointer 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(tidtable.obj) : error LNK2005: __encoded_null 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(tidtable.obj) : error LNK2005: __decode_pointer 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(crt0dat.obj) : error LNK2005: __amsg_exit 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(crt0dat.obj) : error LNK2005: __initterm_e 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(invarg.obj) : error LNK2005: __invalid_parameter 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(mlock.obj) : error LNK2005: __lock 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(mlock.obj) : error LNK2005: __unlock 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(winxfltr.obj) : error LNK2005: ___CppXcptFilter 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(crt0init.obj) : error LNK2005: ___xi_a 已经在 MSVCRTD.lib(cinitexe.obj) 中定义

1>libcmtd.lib(crt0init.obj) : error LNK2005: ___xi_z 已经在 MSVCRTD.lib(cinitexe.obj) 中定义

1>libcmtd.lib(crt0init.obj) : error LNK2005: ___xc_a 已经在 MSVCRTD.lib(cinitexe.obj) 中定义

1>libcmtd.lib(crt0init.obj) : error LNK2005: ___xc_z 已经在 MSVCRTD.lib(cinitexe.obj) 中定义

1>libcmtd.lib(hooks.obj) : error LNK2005: “void __cdecl terminate(void)” (?terminate@@YAXXZ) 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(_file.obj) : error LNK2005: ___iob_func 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(stricmp.obj) : error LNK2005: __stricmp 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(fflush.obj) : error LNK2005: _fflush 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmtd.lib(getenv.obj) : error LNK2005: _getenv 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcpmtd.lib(string.obj) : 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> >(char const *)” (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>libcpmtd.lib(string.obj) : 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?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>libcpmtd.lib(string.obj) : 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?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>libcpmtd.lib(string.obj) : 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@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>libcpmtd.lib(string.obj) : error LNK2005: “public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)” (??1_Container_base_secure@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>libcpmtd.lib(string.obj) : error LNK2005: “public: __thiscall std::_Container_base_secure::_Container_base_secure(void)” (??0_Container_base_secure@std@@QAE@XZ) 已经在 msvcprtd.lib(MSVCP90D.dll) 中定义

1>libcmt.lib(stdexcpt.obj) : error LNK2005: “public: __thiscall std::exception::exception(void)” (??0exception@std@@QAE@XZ) 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmt.lib(stdexcpt.obj) : error LNK2005: “public: __thiscall std::exception::exception(char const * const &)” (??0exception@std@@QAE@ABQBD@Z) 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmt.lib(stdexcpt.obj) : error LNK2005: “public: __thiscall std::exception::exception(class std::exception const &)” (??0exception@std@@QAE@ABV01@@Z) 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmt.lib(stdexcpt.obj) : error LNK2005: “public: virtual __thiscall std::exception::~exception(void)” (??1exception@std@@UAE@XZ) 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>libcmt.lib(stdexcpt.obj) : error LNK2005: “public: virtual char const * __thiscall std::exception::what(void)const ” (?what@exception@std@@UBEPBDXZ) 已经在 MSVCRTD.lib(MSVCR90D.dll) 中定义

1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: __strnicmp 已经在 libcmtd.lib(strnicmp.obj) 中定义

1>   正在创建库 G:\code_public\VC\XP2P\Nadpop\Debug\Nadpop.lib 和对象 G:\code_public\VC\XP2P\Nadpop\Debug\Nadpop.exp

1>LINK : warning LNK4098: 默认库“MSVCRTD”与其他库的使用冲突;请使用 /NODEFAULTLIB:library

1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: 默认库“libcmt.lib”与其他库的使用冲突;请使用 /NODEFAULTLIB:library

1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: 默认库“libcmtd.lib”与其他库的使用冲突;请使用 /NODEFAULTLIB:library

1>libcmtd.lib(crt0.obj) : error LNK2019: 无法解析的外部符号 _main,该符号在函数 ___tmainCRTStartup 中被引用


解决方法:

方法(一)

如图所示,运行时库 选择 “/MTD”(debug)或者”/MT”(release)

方法(二)

如果是MFC的工程,按照上面的设置后会出现如下错误:

g:\program files (x86)\vc2008\atlmfc\include\afxver_.h(81) : fatal error C1189: #error :  Please use the /MD switch for _AFXDLL builds

此时就不能按照上面的方法设置,应该设置如下:

如图,MFC的使用,改成“在静态库中使用MFC”


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值