c++linuxc++11

what c++ norme i'm currently using?


Recently I had faced compiling errors in a c++ code I wrote so I've been asked if I was using a C++11 compiler, but honestly I don't know how to check on my compiler version ! so any idea how to figure this out ??

Btw I'm using codeblocks as an IDE which includes the GCC compiler and GDB debugger from MinGW. also if I'm compiling my c++ code under Linux what command should I run to know my compiler version ?


Solution

  • That can be a tricky question. C++11 refers to a version of the standard, not to a version of the compiler. Different compilers, and different versions of any given compiler, will typically implement a mix of versions of the standard, at least for recent versions. More or less, because any implementation of C++11 will be fairly new, and thus probably fairly buggy.

    Most compilers have options to output the version; many will output it systematically in verbose mode. For g++, try g++ --version. Recent versions of g++ do have some support for C++11, but you have to activate it with -std=c++0x (rather than the usual -std=c++03 or -std=c++98). As the name (c++0x, rather than c++11) indicates, it is not truly C++11; it is an implementation of some (most?) of the major new features, in a preliminary version based on various working papers, and not the final standard.

    (FWIW: I don't think any compiler fully implements all of C++11, but I'd love to be proven wrong.)