User forums > Help

How to turn off implicit -I- GCC compiler switch?

(1/2) > >>

uentity:
Hi!
I've just discovered Code::Blocks and it's an amazing IDE!
But I can't solve one annoying problem - when using C::B under Linux with GCC as default compiler an implicit switch -I- is substituted just before other include directives. My GCC 4.2.2 complains about it:
"obsolete option -I- used, please use -iquote instead"
More than that, I've found that this switch leads to compilation errors and prevents my sources from building normally. I've checked all the property pages several times but failed to locate the magic option that controls the addition of this switch.
Do someone has any ideas?

mandrav:
IIRC, this is controlled by the PCH options in project properties. Try playing with those options.

uentity:
Thanks, that was helpful!
Setting the precompiled headers to be generated in the object dir involves adding -I- compiler switch for GCC. I suppose that PCH-related option makes sense only in conjunction with MSVS compiler, am I right? If so, should this behavior be considered as a bug?
This question leads to more generic one - can I use the same project file in Windows (MS compiler) and Linux (GCC compiler) having defined several targets only for Windows MS compiler (and don't touch them in Linux) and similarly some Linux GCC build targets? Is it the right way to go? Or there can be some "non-portable" project options that can produce implicit building problems when switching the platform? Or should I create separate project files for every compiler I use?
Is there some kind of "official" answer for this question?
PS. Something tells me that I should RTFM first, but I'll be grateful to you for response.

mandrav:

--- Quote from: uentity on February 22, 2008, 07:44:41 pm ---Setting the precompiled headers to be generated in the object dir involves adding -I- compiler switch for GCC. I suppose that PCH-related option makes sense only in conjunction with MSVS compiler, am I right? If so, should this behavior be considered as a bug?

--- End quote ---

No, as a matter of fact, PCH support was first added for GCC (in C::B that is).



--- Quote from: uentity on February 22, 2008, 07:44:41 pm ---This question leads to more generic one - can I use the same project file in Windows (MS compiler) and Linux (GCC compiler) having defined several targets only for Windows MS compiler (and don't touch them in Linux) and similarly some Linux GCC build targets? Is it the right way to go? Or there can be some "non-portable" project options that can produce implicit building problems when switching the platform? Or should I create separate project files for every compiler I use?
Is there some kind of "official" answer for this question?
PS. Something tells me that I should RTFM first, but I'll be grateful to you for response.

--- End quote ---

Each target, as well as the project as a whole, has a "platforms" setting which you can use to explicitely mark a project or target as being valid only under certain platforms.
Once again, inspect the project properties window closely.

cacb:

--- Quote from: mandrav on February 22, 2008, 09:29:10 pm ---Each target, as well as the project as a whole, has a "platforms" setting which you can use to explicitely mark a project or target as being valid only under certain platforms.
Once again, inspect the project properties window closely.

--- End quote ---

That is interesting. I have a project using MSVC on Windows and GCC on Linux. It works using 2 build targets for Win and 2 for Linux. However, on linux I always get an annoying warning that "The defined compiler for W32_Debug cannot be located (ID: msvc8), please choose the compiler you want to choose and click OK", see attachment for actual dialog. The problem is that it should not ask about this build target at all on Linux, "Cancel" is the only way out, but it has to be done for every project in the workspace, every time the workspace is opened.

I tried setting the Build target options/Platforms to be "Windows" only for this target and "Unix" for the Linux targets, but the behaviour is no different, I still get the same question at startup. Is there a way to fix it?

[attachment deleted by admin]

Navigation

[0] Message Index

[#] Next page

Go to full version