Setting CodeBlocks to C++11

How do I set CodeBlocks 16.01 to C++11? My selected compiler is GNU GCC Compiler. There is no option for C++11 listed in Compiler Flags under Compiler Settings. If I type -std=c++11 into Other Compiler Options, it gives me an error: unrecognized command line option "-std=c++11".
What version of the compiler are you using? Older versions of the compiler will not support the current standards (versions earlier than version 4.7).

How can I find which version of the compiler I'm using?
What operating system are you using?

You can try gcc --version at the command line. Or you should be able to view the version in the "Build Messages" tab of the "Log Window" of Code::Blocks.

Last edited on
I'm using Windows 10. In Build Messages, it just says GNU GCC Compiler.
I could try gcc --version at the command line. How do you do that?
Open a shell prompt. (IIRC, open the Run dialogue and enter cmd, then press Return.)
Type gcc --version followed by Return into the window which appears.
It says 'gcc' is not recognized as an internal or external command, operable program or batch file.
Okay then in Code::Blocks with no projects open select compiler settings from the Settings menu. Now go to the Tool executable tab and note the Compiler's Installation Directory.

In your shell prompt change to that directory and then type in bin/gcc --version.


I changed to that directory, but I'm still getting an error. What did I do wrong? This is what I typed in:
C:\Program Files (x86)\CodeBlocks\MinGW> bin/gcc --version

'bin' is not recognized as an internal or external command,
operable program or batch file.
I don't remember very much about the Windows shell, but you should be able to get the version of GCC by compiling and running this program:

1
2
3
4
5
6
#include <iostream>
int main() { 
  std::cout << __GNUC__ << '.' 
            << __GNUC_MINOR__ << '.'
            << __GNUC_PATCHLEVEL__ << '\n';
}
It says 4.4.1.
Topic archived. No new replies allowed.