This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding include directories (-I)


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]