User forums > Help

C++11 enabling problem

<< < (2/2)

Jenna:
Simple solution (and cause for the issue):
don't use advanced options if you don't know exactly what they do (that's why they are called advanced)!

Right-click the file in the project-manager, click on "Properties" go to the "Advanced"-tab and change the "Compiler variable" back to "CPP" !
"CC" is the c-compiler and that can not work.

AeroWB:
Thank you very much. Changing the Compiler Variable to CPP fixed it. The weird part is that I have never set this option myself so I was wondering what I did wrong.
Apparently I have started the project with the wizard and selected C in stead of C++ because that sets this option (I tried creating a new project, selected C and checked the project file)
I did a lot of coding, building and testing which al worked fine at first, until I started using threads.
gcc is fine for compiling C++ files but Code::Blocks apparently checks the compiler options and sees the option is for C++ while the project is set to C only and so it filters the option, while still allowing C++ code.
I have never written a C++ project before and also never worked with Code::Blocks so it is al new to me, and this was too confusing for me to solve.
Thanks for the help and thanks for creating this nice IDE.

oBFusCATed:

--- Quote from: AeroWB on August 19, 2014, 10:33:09 pm ---gcc is fine for compiling C++ files but Code::Blocks apparently checks the compiler...

--- End quote ---
Sorry but you're totally wrong! The executable gcc is not fine for c++ code! It is meant for compiling c code. The write executable for C++ code is g++.
GCC with capital letters is something totally different (Gnu Compiler Collection)!

AeroWB:
I was compiling C++ code with gcc (lowercase) and it was working fine, so gcc can compile C++ code. But I searched for the differences and if you use gcc to compile C++ you don't have access to the standard C++ libraries and there are some more differences. So you should indeed always use g++ instead of gcc for compiling C++ code, gcc is not fine for C++ code although it will work sometimes.

Navigation

[0] Message Index

[*] Previous page

Go to full version