验证库中使用的CRT(.lib) [英] Verifying CRT used in library (.lib)

查看:352
本文介绍了验证库中使用的CRT(.lib)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检查Windows中的静态库(.lib)链接到什么运行时库?

How do I check what runtime library a static library (.lib) in Windows has linked to?

我用/ MDd编译我的项目,我链接的库正在使用/ MTd多线程调试

I'm compiling my project with /MDd and I presume a library I'm linking to is using /MTd Multi-threaded Debug

Error   7   error LNK2005: "public: __thiscall std::_Lockit::~_Lockit(void)" (??1_Lockit@std@@QAE@XZ) already defined in libcpmtd.lib(xlock.obj)    C:\...\msvcprtd.lib(MSVCP100D.dll)

LIBCPMTD.LIB =多线程,静态链接

LIBCPMTD.LIB = Multithreaded, static link

我知道有一个选项 / NODEFAULTLIB:libcpmtd.lib这是我试过和成功,但我宁愿避免。

I know there's an option /NODEFAULTLIB:"libcpmtd.lib" which I've tried and succeeded with, but I'd rather avoid that.

推荐答案

我可以解决这个问题。

> dumpbin /DIRECTIVES C:\..\ThirdParty\tidy\windows\lib\libtidy
.lib
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file C:\..\ThirdParty\tidy\windows\lib\libtidy.lib

File Type: LIBRARY

   Linker Directives
   -----------------
   /DEFAULTLIB:"LIBCMT"
   /DEFAULTLIB:"OLDNAMES"
...

我使用/ MDd重新编译lib,它链接得很好。

It's cleary linking to MT. I recompiled the lib using /MDd and it linked fine.

这篇关于验证库中使用的CRT(.lib)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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