Which C++ standard is the default when compiling with g++?

If your version of g++ is later than 4.7 I think you can find the default version of C++ standard supported like so:

g++ -dM -E -x c++  /dev/null | grep -F __cplusplus

An example from my machine:

mburr@mint17 ~ $ g++ --version | head -1
g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
mburr@mint17 ~ $ g++ -dM -E -x c++  /dev/null | grep -F __cplusplus
#define __cplusplus 199711L

Some references:

Leave a Comment