What about compiling and executing the following trivial program ?
#include <iostream>
int main()
{ std::cout << __cplusplus << std::endl; }
The value printed should say the version used:
- 199711 for C++98,
- 201103 for C++11
- 201402 for C++14
- 201703 for C++17
If you compile omitting the -std=c++xx
flag, you should be able to detect the default version of language used.