Re: Adding include directories (-I)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 :)

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux