如何忽略LNK2005& LNK1169? [英] how to ignore LNK2005 & LNK1169?

查看:201
本文介绍了如何忽略LNK2005& LNK1169?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我有一个使用外部库的Visual Studio 2010项目,为了在不使用LNK2005的情况下进行编译,我不得不在链接器设置中弄乱库的顺序.

So I have a Visual Studio 2010 project that uses external libraries and in order to get it compile without LNK2005 I had to juggle arround with the order of the libraries in the linker settings.

我可以在发布模式下很好地编译它,但是出于任何原因,我都无法在没有LNK错误的情况下进行调试.

I got it to compile fine in release mode, but for whatever reasons I don't manage to get it to compile without LNK errors in debug.

是否没有办法通常忽略LNK2005并告诉链接程序简单地使用他首先遇到的内容?

Is there no way to generally ignore LNK2005 and tell the linker to simply use whatever he encounters first?

谢谢!

//edit:这是特殊"问题的一些错误输出.但是我已经尝试以不同的方式解决此问题,每种解决方案都给我带来了不同的链接器问题.因此,我正在寻找忽略LNK2005的通用解决方案

//edit: here are some of the errors output of the PARTICULAR problem. however I already tried to solve that in different ways with each solution giving me different linker problems. hence i'm looking for general solution to ignore LNK2005

Error 7 error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in Libcmtd.lib(typinfo.obj) ...\msvcprtd.lib(MSVCP100D.dll)

Error 7 error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in Libcmtd.lib(typinfo.obj) ...\msvcprtd.lib(MSVCP100D.dll)

Error 8 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) ...\msvcprtd.lib(MSVCP100D.dll)

Error 8 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) ...\msvcprtd.lib(MSVCP100D.dll)

Error 9 error LNK2005: _exit already defined in Libcmtd.lib(crt0dat.obj) ...\msvcprtd.lib(MSVCP100D.dll)

Error 9 error LNK2005: _exit already defined in Libcmtd.lib(crt0dat.obj) ...\msvcprtd.lib(MSVCP100D.dll)

Error 10 error LNK2005: __invalid_parameter already defined in Libcmtd.lib(invarg.obj) ...\msvcprtd.lib(MSVCP100D.dll)

Error 10 error LNK2005: __invalid_parameter already defined in Libcmtd.lib(invarg.obj) ...\msvcprtd.lib(MSVCP100D.dll)

...

Error 37 error LNK1169: one or more multiply defined symbols found

推荐答案

您可以尝试使用链接器选项/FORCE(项目属性"的链接器常规"选项卡中的强制文件输出").即使发生此类错误,这也会强制链接器创建exe/dll.但是留给您找出该exe程序是否可以正常工作甚至正确地工作.毕竟我不推荐这种策略.

You may try the linker-option /FORCE (Force File Output in the Linker General tab of the Project Properties). This will force the linker to create a exe/dll even when such errors occur. But its left to you to find out if this exe does work at all or even correctly. After all i would not recommend this strategy.

链接器错误有时可能很麻烦解决,但通常仅在迁移或设置项目后才需要执行.这可能要花一些时间-有时我花了一天多的时间,但是应该正确完成.

Linker errors can sometimes be tedious to solve, but usually it has to be done only after migrating or setting up a project. This may take quite a while - it sometimes took me more then a day, but it should be done properly.

这篇关于如何忽略LNK2005& LNK1169?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆