How to say that the library was compiled using C ++ 11

How to find out if a specific C ++ library is linked using C ++ 11 standard?

+4
source share
1 answer

The binary elf will by default contain the signature of the version of the compiler used.

Now, as for the compiler flags used, if is -frecord-gcc-switchesused at compile time, you can find the signature in the ELF executable.

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

Reset section line .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
+3
source

Source: https://habr.com/ru/post/1613593/


All Articles