如何判断库是使用C ++ 11编译的 [英] How to tell a library was compiled using C++11

查看:99
本文介绍了如何判断库是使用C ++ 11编译的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何判断某个c ++库是否使用
c ++ 11标准链接?

How can I tell if a certain c++ library was linked using c++11 standard?

推荐答案

elf二进制文件默认情况下会包含所使用的编译器版本的签名。

An elf binary would by default contain the signature of compiler version used.

现在,关于所使用的编译器标志,如果 -frecord-gcc-开关在编译时使用,然后,您可以在ELF可执行文件中找到签名。

Now, with regards to compiler flags used, If -frecord-gcc-switches is used at compile time, then, you can find the signature in ELF executable.

 g++ -frecord-gcc-switches -std=c++0x trial.cpp
readelf -p .GCC.command.line a.out

'。GCC.command.line'部分的字符串转储:

String dump of section '.GCC.command.line':

  [     0]  -imultilib . [     d]  -imultiarch x86_64-linux-gnu   [    2a]  -D_GNU_SOURCE   [ 38]  trial.cpp   [    42]  -mtune=generic   [    51]  -march=x86-64  [    5f]  -std=c++0x   [    6a]  -frecord-gcc-switches   [    80]   
-fstack-protector

这篇关于如何判断库是使用C ++ 11编译的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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