News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Bug Report: GCC -I- (Split include path) breaks some include chains

Started by TDragon, February 04, 2006, 11:53:49 PM

Previous topic - Next topic

TDragon

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 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]
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

titan

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.

TDragon

Quote from: TDragon on February 04, 2006, 11:53:49 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.
[url="https://jmeubank.github.io/tdm-gcc/"]https://jmeubank.github.io/tdm-gcc/[/url] - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)