使用VS2010构建的静态库(.lib)无法链接到在DEBUG模式下使用VS2015构建的应用程序 [英] Static libraries(.lib) built with VS2010 fails to link to an application which is being built with VS2015 in DEBUG mode

查看:236
本文介绍了使用VS2010构建的静态库(.lib)无法链接到在DEBUG模式下使用VS2015构建的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我面临以下问题:

背景:

我使用 VS2010 构建了一个静态库(libXYZload.lib)。在DEBUG模式下使用
VS2015构建(链接)测试应用程序(testapp.exe)时,正在使用相同的库(libXYZload.lib)。



问题描述:

我能够构建我的应用程序'testapp .exe'使用VS2010和VS2012链接使用
VS2010 构建的静态库(libXYZload.lib)。但是对于VS2015,我收到以下错误:




        LINK / nologo / NODEFAULTLIB / OPT:NOREF / NXCOMPAT / DynamicBase  / SAFESEH /out:testapp.exe testapp.obj ml_new.obj ml_trl.lib libsb.lib libcrvs.lib libcat.lib libXYZload.lib libXYZload.lib libredir_std.lib libredir_std.lib legacy_stdio_wide_specifiers.lib
legacy_stdio_definitions.lib libvcruntime.lib libucrt.lib oldnames.lib kernel32.lib user32.lib netapi32.lib  gdi32.lib comdlg32.lib  comctl32.lib wsock32.lib shell32.lib   Rpcrt4.lib oleaut32.lib Ole32.lib Wbemuuid.lib wintrust.lib crypt32.lib
Ws2_32.lib iphlpapi.lib Psapi.lib advapi32.lib Shlwapi.lib dhcpcsvc.lib userenv.lib tbs.lib libcmt。 lib test_dongle_stub.lib

test_dongle_stub.lib(m_xyzstub.obj):警告LNK4075:由于'/ OPT:LBR'规范而忽略'/ EDITANDCONTINUE'为
libXYZload.lib( TestlmCICO.obj):错误LNK2019:未解析的外部符号" public:char const * __thiscall type_info :: name(struct __type_info_node *)const" (?name @ type_info @@ QBEPBDPAU__type_info_node @@@ Z)在函数_Security_Testing中引用

libXYZload.lib(TestPublicInterface.obj):错误LNK2001:未解析的外部符号" public:char const * __thiscall type_info: :name(struct __type_info_node *)const" (?name @ type_info @@ QBEPBDPAU__type_info_node @@@ Z)

testapp.exe:致命错误LNK1120:1个未解析的外部因素

NMAKE:致命错误U1077:'" C :\ Program Files(x86)\ Microsoft Visual Studio 14.0\VC \BIN \LINK.EXE"':返回代码'0x460'

停止。



我无法识别库中哪个符号丢失,因为它在VS2010和VS2012上成功构建了¥b $ b有人可以解释一下得到上述错误的原因?以及如何解决它?

$
注意:此问题仅在DEBUG模式下发生,在发布模式下正常工作。

Background:
I have built a static library(libXYZload.lib) using VS2010. The same library(libXYZload.lib) is being used while building(linking) the test application(testapp.exe) with VS2015 in DEBUG mode.

Problem Description:
I am able to build my application 'testapp.exe' using VS2010 and VS2012 by linking the static library(libXYZload.lib) built with VS2010. But with VS2015, I get the following error:


        LINK /nologo /NODEFAULTLIB /OPT:NOREF /NXCOMPAT /DynamicBase  /SAFESEH /out:testapp.exe testapp.obj ml_new.obj ml_trl.lib libsb.lib libcrvs.lib libcat.lib libXYZload.lib libXYZload.lib libredir_std.lib libredir_std.lib legacy_stdio_wide_specifiers.lib legacy_stdio_definitions.lib libvcruntime.lib libucrt.lib oldnames.lib kernel32.lib user32.lib netapi32.lib  gdi32.lib comdlg32.lib  comctl32.lib wsock32.lib shell32.lib  Rpcrt4.lib oleaut32.lib Ole32.lib Wbemuuid.lib wintrust.lib crypt32.lib Ws2_32.lib iphlpapi.lib Psapi.lib advapi32.lib Shlwapi.lib dhcpcsvc.lib userenv.lib tbs.lib libcmt.lib test_dongle_stub.lib
test_dongle_stub.lib(m_xyzstub.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification
libXYZload.lib(TestlmCICO.obj) : error LNK2019: unresolved external symbol "public: char const * __thiscall type_info::name(struct __type_info_node *)const " (?name@type_info@@QBEPBDPAU__type_info_node@@@Z) referenced in function _Security_Testing
libXYZload.lib(TestPublicInterface.obj) : error LNK2001: unresolved external symbol "public: char const * __thiscall type_info::name(struct __type_info_node *)const " (?name@type_info@@QBEPBDPAU__type_info_node@@@Z)
testapp.exe : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\LINK.EXE"' : return code '0x460'
Stop.

I am not able to identify which symbol is missing from the library as it builds successfully on VS2010 and VS2012
Can someone please explain the reason for getting the above error? and how to resolve it?

NOTE:This issue happens only in DEBUG mode and works fine in release mode.

问候,

Vinay

推荐答案

您好

嗯,"type_info :: name"不见了。可能是,你已经设置了其他选项(例如unicode,或者define,typedef ......),或者新的编译器会生成其他不兼容的代码(修改......就像那样)。

Well, the "type_info::name" is missing. Could be, that you have set other options (e.g. unicode, or a define, typedef...) or that the new compiler generates other code that's incompatible (mangling... things like that).

但是......我不会进一步调查这个问题。因为根据C ++标准,没有像"lib"这样的东西。因此,每个编译器都使用它自己的lib-format。因此,链接到使用其他编译器构建的
的lib并不是一个好主意。也许格式从2012年改为2015年。

But... I would not investigate this further. Because according to the C++ standard there is no such thing like a "lib". Therefore every compiler uses it's own lib-format. And therefore it's not a good idea to link to a lib that has been built with an other compiler. Maybe the format changed from 2012 to 2015.

我建议使用用于构建最终exe / dll的相同编译器重新编译lib。

I'd recommend to recompile your lib with the same compiler you use to build the final exe/dll.

鲁道夫


这篇关于使用VS2010构建的静态库(.lib)无法链接到在DEBUG模式下使用VS2015构建的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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