User forums > Using Code::Blocks

Avoid warning "command line option "-std=c++0x" is valid for C+"

(1/2) > >>

camilocc:
Hi,

I  am using Code::Blocks in CentOS, Ubuntu and openSUSE.

Some of my projects mixe C files and CPP files in the same project

Is there a way to specify -std=c++0x option only for g++ (CPP) and not gcc (CC)?

When building, I get these warnings:

warning: command line option "-std=c++0x" is valid for C++/ObjC++ but not for C

Because of the C files.

I cannot find in Google, may be there is a workaround like something like -Wno-(...) for avoiding the warning for C files  but I cannot find also...

Someone could help?

Would it be a feature request for Code::Blocks : to apply this flag only for g++?

Thank you in advance,
Camilo

oBFusCATed:
You have to separate the c and c++ files in two targets or two projects.
One of them should build a static library and the other should link it.

Alpha:

--- Quote from: oBFusCATed on September 13, 2013, 01:45:59 pm ---You have to separate the c and c++ files in two targets or two projects.

--- End quote ---
Alternatively, you could use a trunk/nightly build.

oBFusCATed:

--- Quote from: Alpha on September 13, 2013, 03:20:58 pm ---Alternatively, you could use a trunk/nightly build.

--- End quote ---
Can you elaborate on this statement a bit?

Alpha:
The merge of the XML compiler branch added the option to specify filtering of flags to a given compiler based on if it was C or C++ mode.  The predefined filter is:
src/plugins/compilergcc/resources/compilers/options_common_sort.xml

Navigation

[0] Message Index

[#] Next page

Go to full version