Find out which C++ standard is supported by g++.

cplusplus

I’m fiddling around with some stuff in Docker, and need the c++ compiler to support C++14. How to check? Run

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

Example from my docker container – so this version of g++ supports the C++17 standard. Relevant StackOverflow post.

# g++ -dM -E -x c++  /dev/null | grep -F __cplusplus
#define __cplusplus 201703L
root@d804ccfaefc5:/# exit

© Amy Tabb 2018 - 2026. All rights reserved. The contents of this site reflect my personal perspectives and not those of any other entity.