How to tell if a lib was compiled with /mt or /md?(如何判断一个库是用/mt 还是/md 编译的?)
问题描述
给定一个编译的lib,有没有办法通过查看它来判断它是用/md还是/mt编译的(也许使用 dumpbin 工具)?
Given a compiled lib, is there a way to tell if it was compiled with /md or /mt just by looking at it (maybe with dumpbin tool)?
dumpbin/directives foo.lib 是针对 lib 未使用 /GL 开关编译的情况的解决方案.是否可以选择检查以这种方式优化的 lib 文件?
dumpbin /directives foo.lib is a solution for the case where the lib was not compiled with /GL switch. Is there an option to inspect a lib file that was optimized in such a way?
推荐答案
是的,您可以使用 dumpbin 的 /DIRECTIVES 选项来查找 .lib 中的对象想要链接到哪些运行时库:
Yes, you could use dumpbin's /DIRECTIVES option to find which runtime libraries the objects in the .lib want to link with:
dumpbin /directives foo.lib
在此处查找指定的运行时库的实例.例如,您可能会看到:
Look for instances of the runtime libraries specified here. For example, you might see:
/DEFAULTLIB:MSVCRTD(使用/MDd 编译的模块)
/DEFAULTLIB:MSVCRTD (module compiled with /MDd)
或
/DEFAULTLIB:MSVCRT(使用/MD 编译的模块)
/DEFAULTLIB:MSVCRT (module compiled with /MD)
或
/DEFAULTLIB:LIBCMT(使用/MT 编译的模块)
/DEFAULTLIB:LIBCMT (module compiled with /MT)
可能会有很多 /DEFAULTLIB 指令,因此您可以使用以下术语进行搜索:
There will probably be many /DEFAULTLIB directives, so you can search using terms like:
dumpbin /DIRECTIVES foo.lib | find /i "msvcr"
这篇关于如何判断一个库是用/mt 还是/md 编译的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何判断一个库是用/mt 还是/md 编译的?
基础教程推荐
- C++:获取传递给函数的多维数组的行大小 2021-01-01
- c++ STL设置差异 2022-01-01
- 将不可复制的闭包对象传递给 std::function 参数 2021-01-01
- 随机插入/删除的综合向量与链表基准 2022-01-01
- 提升 ASIO 流缓冲 2021-01-01
- 如何更改 SysDateTimePick32 或 CDateTimeCtrl 的背景颜色? 2022-01-01
- 如何部分禁用 cmake C/C++ 自定义编译器检查 2021-01-01
- 如何在 C++ 中正确使用命名空间? 2022-01-01
- 与 CAS 的原子交换(使用 gcc 同步内置函数) 2022-01-01
- 为什么我们不能使用“虚拟继承"?在 COM 中? 2022-01-01
