Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Dmytry on December 03, 2015, 07:14:35 am

Title: -std=c++11 is passed even when compiling c files (gives error with clang)
Post by: Dmytry on December 03, 2015, 07:14:35 am
I was trying to compile a project that uses c and c++11 files, with clang as the compiler, and I'm getting

error: invalid argument '-std=c++11' not allowed with 'C/ObjC'

Is there any easy way not to set this option for the c files?

edit: found a (less than optimal) solution: un-setting the c++11 option and editing the toolchain executables and adding -std=c++11 there just for the c++ compiler .
Title: Re: -std=c++11 is passed even when compiling c files (gives error with clang)
Post by: scarphin on December 03, 2015, 11:03:37 am
I think it's not a bug but an incapability to set different settings for C and C++ sources. They should be separated imo.
Title: Re: -std=c++11 is passed even when compiling c files (gives error with clang)
Post by: Jenna on December 03, 2015, 05:38:23 pm
You should be able to add -std=c++11 to the c++ only flags.
Just right click into the compiler options ...