How to tell a library was compiled using C++11

十年热恋 提交于 2019-12-09 17:27:44

问题


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


回答1:


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

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

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


来源:https://stackoverflow.com/questions/33407016/how-to-tell-a-library-was-compiled-using-c11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!