Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: TDragon on February 04, 2006, 11:53:49 pm

Title: Bug Report: GCC -I- (Split include path) breaks some include chains
Post by: TDragon on February 04, 2006, 11:53:49 pm
As of r1942 (I don't know how long it's been in place), the -I- option is being passed on the command line when precompiling a header in the object output dir. As noted here (http://gcc.gnu.org/onlinedocs/gcc-3.4.5/gcc/Preprocessor-Options.html#index-I_002d-497) in the GCC manual, -I- inhibits the use of the directory of the current file directory as the first search directory for #include "file". This affects the include chains of popular libraries such as Allegro (where I first noticed it), such that any file in the chain whose directory is not in the list of include paths to search will not be found with a double-quoted #include directive.

This behavior is demonstrated by the attached project, in which the project SomeProject has a precompiled header which includes the main library header SomeLibrary.h. SomeLibrary.h includes SLAnotherHeader.h, which in turn tries to include SLYetAnotherHeader.h but fails. If the -I- command-line switch is removed, the command succeeds.

EDIT: Forgot to attach the file...oops

[attachment deleted by admin]
Title: Re: Bug Report: GCC -I- (Split include path) breaks some include chains
Post by: titan on April 14, 2006, 06:21:55 pm
To remove the annoying -I- gcc compiler flag, try this workaround:

Project Options -> PCH Strategy -> "Generate PCH in a directory alongside original header"

If you use precompiled headers, this may affect your build in other ways.  It's a workaround for now.
Title: Re: Bug Report: GCC -I- (Split include path) breaks some include chains
Post by: TDragon on April 14, 2006, 06:40:47 pm
..., the -I- option is being passed on the command line when precompiling a header in the object output dir.
I am indeed aware that the other PCH strategies don't use the -I- option, but the other PCH strategies also aren't as flexible.