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
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.
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.
Alternatively, you could use a trunk/nightly build.
Quote from: Alpha on September 13, 2013, 03:20:58 PM
Alternatively, you could use a trunk/nightly build.
Can you elaborate on this statement a bit?
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 (http://cb.biplab.in/websvn/filedetails.php?repname=codeblocks&path=%2Ftrunk%2Fsrc%2Fplugins%2Fcompilergcc%2Fresources%2Fcompilers%2Foptions_common_sort.xml)
Although, reading back through the code now,
wxString cFlags = m_CFlags[target];
wxArrayString remFlags;
if (compExec == ceC)
remFlags = GetArrayFromString(compiler->GetCPPOnlyFlags(), wxT(" "));
else if (compExec == ceCPP)
remFlags = GetArrayFromString(compiler->GetCOnlyFlags(), wxT(" "));
if (!remFlags.IsEmpty())
{
wxArrayString aCflags = GetArrayFromString(cFlags, wxT(" "));
for (size_t i = 0; i < remFlags.GetCount(); ++i)
{
int index = aCflags.Index(remFlags[i]);
if (index != wxNOT_FOUND)
aCflags.RemoveAt(index);
}
cFlags = GetStringFromArray(aCflags, wxT(" "), false);
}
might be performance critical.
So if I understand you correctly this is a non-issue in trunk (the flag is not passed to gcc)?
Looking at it - I see that it is bloody dangerous wxArrayString based code! :)
Quote from: oBFusCATed on September 13, 2013, 04:39:07 PM
So if I understand you correctly this is a non-issue in trunk (the flag is not passed to gcc)?
Yes.
Quote from: oBFusCATed on September 13, 2013, 04:39:07 PM
Looking at it - I see that it is bloody dangerous wxArrayString based code! :)
At some point I want to rewrite this... as my time allows.