This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Adding include directories (-I)
- From: Sebastian Biallas <sb at biallas dot net>
- To: John Love-Jensen <eljay at adobe dot com>
- Cc: MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Wed, 28 Feb 2007 16:49:14 +0100
- Subject: Re: Adding include directories (-I)
- References: <C20AFEE4.1CE95%eljay@adobe.com>
John Love-Jensen wrote:
> Hi Sebastian,
>
>> Which command line switch of gcc is preferred for adding include directories?
>
> -I<dir> for user includes.
>
> -isystem <dir> for system includes.
>
>> And: What's the reason that -I modifies system headers includes?
>
> It doesn't.
>
> -I includes are searched before system includes, for #include "blah.h".
No, they are also searched before system includes for #include <blah.h>:
$ cat test.c
#include <stdlib.h>
$ cat stdlib.h
#error bla
$ gcc -c -I. -o test.o test.c
In file included from test.c:1:
./stdlib.h:1:2: Error: #error bla
There is "-iquote" which only modifies "" includes, but nobody uses it.
And it's hard to use if there's no stable name between gcc versions.
> That would only be a problem if #include "process.h" is used, when #include
> <process.h> was intended.
Well, no. There is no longer a difference between "process.h" and
<process.h> if you use "-I.". That's my problem :)