Reputation: 123
CodeBlocks
keeps giving me this error even though there is no -std=c++11
option enabled (I checked all the settings and the project file).
Is there A way to disable this?
Upvotes: 1
Views: 8417
Reputation: 61202
This is my best guess. The compiler you are using to build the project
is gcc. You have -std=c++11
set in your global settings
for this compiler but the installed version of gcc is too old to
recognize the option.
To check this out in the Code::Blocks IDE:
Navigate Settings -> Compiler
From the drop-down menu labelled Selected compiler, select the GNU GCC compiler
On the tab-panel below, select Compiler settings -> Compiler flags
From the drop-down menu labelled "Categories", select <All categories>
.
Look down the check-box list of compiler options until you see:
Have g++ follow the C++11 ISO C++ language standard [-std=c++11]
If that fixes the problem, you should consider upgrading gcc to a version (>= 4.7)
that supports the -std=c++11
option as you will then have support for the C++
language and library features of the latest C++ standard.
If you cannot do that, you may find that the -std=c++0x
option is acceptable
to your compiler. If that works, it will provide support for some provisional
version of the C++11 standard that was operative when your compiler was released.
A less likely scenario than the above is that the compiler you are using to
build the project is not gcc but some other and non-commandline-compatible
compiler than you have set up in Code::Blocks by copying GCC's global
configuration, in which the -std-c++11
option is set. In that case you just
have to ensure that no global options are configured for this compiler that
it does not recognize.
For your future reference, if you have a problem with the commandline options of a c++ compiler, say what compiler it is, and what version.
Upvotes: 5