C++ 有一个静态库,有没有一种简单的方法可以知道它是 32 位还是 64 位?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6014107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Have a static lib, is there a simple way to know it is for 32 bit or 64 bit?
提问by user705414
Is there any tool that can directly test if a library is made for 32 or 64 bit?
有没有什么工具可以直接测试一个库是为32位还是64位制作的?
采纳答案by Alok Save
You can use dumpbin
utility with /headers
option
您可以使用dumpbin
带有/headers
选项的实用程序
It returns whether the library was built for 32 or 64 bit architecture.
它返回库是为 32 位架构还是 64 位架构构建的。
Check DUMPBIN Referencefor details.
有关详细信息,请查看DUMPBIN 参考。
Example usage:
用法示例:
c:\>dumpbin libXYZ.lib /headers
回答by Jet Set Willy
Run a visual studio command prompt to ensure your path can find dumpbin.exe
运行 Visual Studio 命令提示符以确保您的路径可以找到 dumpbin.exe
Pipe to findstr to save on the big spew about each section and optionally you can use a wildcard to analyse a folder of libs.
管道到 findstr 以保存有关每个部分的大量信息,并且您可以选择使用通配符来分析 libs 文件夹。
dumpbin /headers *.lib | findstr machine
dumpbin /headers *.lib | findstr machine
Example of what you're looking for;
您正在寻找的示例;
8664 machine (x64)
回答by Vikram.exe
回答by Ayush joshi
In visual studio, we can get to know about whether Lib/dll is 32 or 64 bit with Coreflags.exe This tool is automatically installed with Visual Studio. we can run this command from Command line, which can be run as
在visual studio中,我们可以通过Coreflags.exe了解Lib/dll是32位还是64位。这个工具是随Visual Studio自动安装的。我们可以从命令行运行这个命令,它可以作为
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\CorFlags.exe whatever_Lib_with_path
This command will return you whether that file is managed or Unmanaged. If its managedthen it can give info about that is is 32/64 bit.
此命令将返回该文件是托管的还是非托管的。如果它是托管的,那么它可以提供有关 32/64 位的信息。