Author Topic: Bug Report: GCC -I- (Split include path) breaks some include chains  (Read 3480 times)

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
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]
« Last Edit: February 04, 2006, 11:56:05 pm by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline titan

  • Single posting newcomer
  • *
  • Posts: 4
Re: Bug Report: GCC -I- (Split include path) breaks some include chains
« Reply #1 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.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Bug Report: GCC -I- (Split include path) breaks some include chains
« Reply #2 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.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)