Thanks for the replies, interesting to hear it just works for some.
The problem is even weirder as my project file which has both -std=c++11 options is not working when I load it in Code::Blocks, I have to add the c++11 option again in the build options before it works.
When I open below project and press build it fails with the error:
-------------- Build: Debug in wb (compiler: GNU GCC Compiler)---------------
gcc -Wall -fexceptions -pthread -g -c /home/willem/Documents/CodeBlocksProjects/wb/wb.cc -o obj/Debug/wb.o
In file included from /usr/include/c++/4.8/thread:35:0,
from /home/willem/Documents/CodeBlocksProjects/wb/wb.cc:16:
/usr/include/c++/4.8/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
And a lot more error after that.
Now when I right-click the project, select build options -> other options and add -std=c++11 the project builds ok.
If I remove all -std=c++11 options from the project file, open the project, right-click the project, select build options -> other options and add -std=c++11 Code::Blocks says: The compiler flags -std=c++11 were stated in 'Other options' but unchecked in 'Compiler Flags'. Do you want to enable these flags?
When I select Yes and Build the project fails.
When I select No and Build the project also fails.
When I select Yes, right-click the project, select build options -> other options and add -std=c++11 again and Build the project works (and the project file has 2 times the c++11 defined but opening the project removes the c++11 option from other options and it will fail)
So I have to select the c++11 compiler flag once and I have to add the same setting to other options every time I open the project.
Project File:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="wb" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/wb" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Option projectLinkerOptionsRelation="0" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="-std=c++11" />
<Add option="-Wall" />
<Add option="-fexceptions" />
<Add option="-pthread" />
<Add option="-std=c++11" />
</Compiler>
<Linker>
<Add option="-pthread" />
</Linker>
<Unit filename="include/linux/can.h" />
<Unit filename="wb.cc">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>