visual studio 2008中 error LNK2005的解决方法

原创 2015年07月06日 18:22:11
1>------ Rebuild All started: Project: LookUpTableTest, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'LookUpTableTest', configuration 'Debug|Win32'
1>Compiling...
1>LookUpTableTest.cpp
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>Linking...
1>msvcprtd.lib(MSVCP90D.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@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ) already defined in libcpmtd.lib(string.obj)
1>msvcprtd.lib(MSVCP90D.dll) : 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) already defined in LookUpTableTest.obj
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: int __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::compare(char const *)const " (?compare@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEHPBD@Z) already defined in LookUpTableTest.obj
1>msvcprtd.lib(MSVCP90D.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?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in LookUpTableTest.obj
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: void __thiscall std::_Container_base_secure::_Orphan_all(void)const " (?_Orphan_all@_Container_base_secure@std@@QBEXXZ) already defined in LookUpTableTest.obj
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z) already defined in libcpmtd.lib(stdthrow.obj)
1>msvcprtd.lib(MSVCP90D.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?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in libcpmtd.lib(string.obj)
1>msvcprtd.lib(MSVCP90D.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> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in libcpmtd.lib(string.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Lockit::_Lockit(int)" (??0_Lockit@std@@QAE@H@Z) already defined in libcpmtd.lib(xlock.obj)
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Container_base_secure::~_Container_base_secure(void)" (??1_Container_base_secure@std@@QAE@XZ) already defined in LookUpTableTest.obj
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::_Container_base_secure::_Container_base_secure(void)" (??0_Container_base_secure@std@@QAE@XZ) already defined in LookUpTableTest.obj
1>msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "bool __cdecl std::operator==<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 &,char const *)" (??$?8DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@PBD@Z) already defined in LookUpTableTest.obj
1>msvcprtd.lib(MSVCP90D.dll) : 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> >::erase(unsigned int,unsigned int)" (?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z) already defined in LookUpTableTest.obj
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: __invalid_parameter already defined in LIBCMTD.lib(invarg.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: __CrtDbgReportW already defined in LIBCMTD.lib(dbgrptw.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: "public: virtual __thiscall std::exception::~exception(void)" (??1exception@std@@UAE@XZ) already defined in LIBCMTD.lib(stdexcpt.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: "public: __thiscall std::exception::exception(void)" (??0exception@std@@QAE@XZ) already defined in LIBCMTD.lib(stdexcpt.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: "public: __thiscall std::exception::exception(class std::exception const &)" (??0exception@std@@QAE@ABV01@@Z) already defined in LIBCMTD.lib(stdexcpt.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: "public: __thiscall std::exception::exception(char const * const &)" (??0exception@std@@QAE@ABQBD@Z) already defined in LIBCMTD.lib(stdexcpt.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgfree.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgmalloc.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _printf already defined in LIBCMTD.lib(printf.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: ___iob_func already defined in LIBCMTD.lib(_file.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _atoi already defined in LIBCMTD.lib(atox.obj)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: _sprintf already defined in LIBCMTD.lib(sprintf.obj)
1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in 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) already defined in LIBCMTD.lib(typinfo.obj)
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>.\Debug/LookUpTableTest.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Build log was saved at "file://e:\论文相关\Marching cubes\MarchingCubes\Debug\BuildLog.htm"
1>LookUpTableTest - 29 error(s), 1 warning(s)

========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========



试了很多很多方法,最终在VS2008的help中查到一种方法,竟然好了,就是在项目的properties-->configuration properties-->Command Lines中输入/FORCE:MULTIPLE   确定就好了

xxx.obj : error LNK2005 ................已经在x.obj中定义 ……

编程中经常能遇到LNK2005错误——重复定义错误,其实LNK2005错误并不是一个很难解决的错误。弄清楚它形成的原因,就可以轻松解决它了。        造成LNK2005错误主要有以下几种情况: ...

vs2010错误处理

如题,托管C++类库下引用一个C语言写的静态库,编译后出现链接错误LNK2005: 错误 1 error LNK2005: __cexit 已经在 MSVCRTD.lib(MSVCR100D.d...

关于VS2008编译错误"error LNK2005: 已经在 .obj 中定义"

关于VS2008编译错误"error LNK2005: 已经在 .obj 中定义"   无意中遇到了这样的编译问题, 于是google,发现在.h文件里定义变量,发生这问题的概率是灰...

Windows7:Visual Studio 2008试用版的评估期已经结束 的解决方法

WinXP下一直安装的同一个VS2008ProCN 90天试用版,安装完后然后在添加删除程序中进行升级,输入Key后就可以正常使用。后来换了Win7后却找不到输入Key的输入框o(╯□╰)o ,问了度...
  • wwwdbs
  • wwwdbs
  • 2015年04月07日 13:15
  • 1832

Visual Studio 2008中三大问题的解决方法

Visual Studio 2008现在使用的开发人员还为数不少,不过在开发过程中,肯定会出现一些问题,这里集中讨论其中的三个问题,希望有所帮助。 很久没有写技术相关的博客了,今天将一些容易遇到,...
  • naujuw
  • naujuw
  • 2012年08月03日 16:33
  • 1488

Visual Studio 2008 安装失败(“Web 创作组件”无法安装)解决方法

Visual Studio 2008 安装失败(“Web 创作组件”无法安装)解决方法(一) 今天安装VS2008时出现了问题,怎么都无法安装成功。装了好几次都在“Visual Studio Web ...
  • Wentasy
  • Wentasy
  • 2011年10月15日 19:32
  • 1358

Windows7:Visual Studio 2008试用版的评估期已经结束解决方法

以前在Windows2003碰到这个问题时,都是到"控制面板→添加或删除程序"选择删除VS2008,然后会有个地方让输入序列号升级就可以了,但这次没有输序列号的地方: 百度后说是因为我现...

错误:error LNK2005 解决方法

编译时链接错误如下: MySAX2Handler.obj : error LNK2005:"public: __thiscall AttributeDetails::AttributeDetails...

c++ error LNK2005......错误解决方法

错误如图 解决方案: 一 今天被error LNK2005这个问题折腾了好久好久,从网上找了一些文章看了看,大多数都说是 头文件包含比较混乱,同一个文件被多个文件包含了;还有的说是某两个...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:visual studio 2008中 error LNK2005的解决方法
举报原因:
原因补充:

(最多只允许输入30个字)