0
votes

in cmd I typed g++ -v which results the message :

Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=C:/Program\ Files\ (x86)/CodeBlocks/MinGW/bin/../libexec/gcc/mingw32/5.1.0/lto-wrapper.exe Target: mingw32 Configured with: ../../../src/gcc-5.1.0/configure --build=mingw32 --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --disable-symvers --enable-cxx-flags='-fno-function-sections -fno-data-sections -DWINPTHREAD_STATIC' --prefix=/mingw32tdm --with-local-prefix=/mingw32tdm --with-pkgversion=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://tdm-gcc.tdragon.net/bugs Thread model: posix gcc version 5.1.0 (tdm-1)

I want to know what is my c++ version? which one it is, c++11/c++14/c++17?

1
Your compiler version is gcc-5.1.0. A compiler can support several different language versions, typically specified via optional compiler flags, e.g. for GCC -std=c++11, -std=c++14 and so on. GCC 5.1 is very old though (released April 22, 2015), and probably only offers partial C++14 support (no C++17 support, and likely full C++11 support).dfrib
Please read the documentation of GCC and consider upgrading to GCC 10. Your g++ is obsoleteBasile Starynkevitch
by how I do set a language by default to run on (say c++14)panic
You just read the documentation about invoking GCC but you should upgrade your GCC compilerBasile Starynkevitch

1 Answers

1
votes

It seems as though your compiler version is 5.1.0 (from the directory name in the path)

C++11, or C++14 or C++17 do not have to do with the version of your downloaded compiler. Any compiler should have all of the versions of the standard which the compiler has implemented included in its download (as Nicolas Dusart pointed out, GCC 5.1.0 has only up to C++14). So you can specify which language specification you want to compile with with the -std={c++11, c++14, c++17} flag.

For instance, if you want to compile code using Concepts (a c++20 feature) you would have to use:

g++ main.cpp -o hello_world -std=c++20