🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41616

Re: another gcc option question, this time about -I-

#41616
From: David Wald
Date: Wed, 28 Feb 1996 00:00
28 lines
1824 bytes
In article <EJH.96Feb27112424@larry.gsfc.nasa.gov>
ejh@larry.gsfc.nasa.gov (Edward Hartnett) writes:
>`-I-'
>     Any directories you specify with `-I' options before the `-I-'
>     option are searched only for the case of `#include "FILE"'; they
>     are not searched for `#include <FILE>'.
...
>I think I understand what this option does, but I don't quite
>understand why one would want to do this. Is it just to save the
>compiler's search time? Or is there some deeper meaning?

It's useful in case a file in your project has the same name as a
system header file.  For instance, I once inherited a project which
had a header file "task.h".  Unfortunately, this was also the name of
a system header included by other system headers, so when those other
headers said "#include <task.h>" they got the project's "task.h"
instead, which confused them no end.

   gcc ... -I. -Iproject_dir1 -Iproject_dir2 -I- -Isystem_dir1 -Isystem_dir2

ensured that system headers could only include other system headers
(assuming they were well enough behaved to use <...> notation).

-David
-- 
============================================================================
David Wald      http://theory.lcs.mit.edu/~wald/     wald@theory.lcs.mit.edu
============================================================================
Technical Details
Message-ID: <WALD.96Feb28095542@woodpecker.lcs.mit.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <EJH.96Feb27112424@larry.gsfc.nasa.gov>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,eedd9c1c19d41318
X-Google-Attributes: gid11318c,public
From: wald@theory.lcs.mit.edu (David Wald)
Subject: Re: another gcc option question, this time about -I-
Date: 1996/02/28
Message-ID: <WALD.96Feb28095542@woodpecker.lcs.mit.edu>
X-Deja-AN: 141496766
references: <EJH.96Feb27112424@larry.gsfc.nasa.gov>
organization: Theory of Computation, LCS, MIT
followup-to: gnu.gcc.help
newsgroups: gnu.gcc.help