This is the mail archive of the gcc@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]

Re: Is this correct? (contradicting includes)


Please read the CPP manual.  Zack put a lot of effort into rewriting
it; I put a lot of effort into making sure a whole bunch of things
were documented that never used to be before he rewrote it.  It is now
an excellent, and almost complete, reference for how CPP works from
the user's point of view.

With only 1 exception, #include "" looks in the directory of the
current file first.  To find out the exception, you should read the
manual.

Neil.

Martin Kahlert wrote:-

> Hi!
> I was hit by this:
> $ cat Old/i1.h
> #include "i2.h"
> 
> $ cat Old/i2.h
> #define A OLD
> 
> $ cat New/i2.h
> #define A NEW
> 
> $ cat t.c
> #include "i1.h"
> A
> #undef A
> #include "i2.h"
> A
> 
> (There is *no* New/i1.h file)
> 
> $ gcc -E -I New -I Old t.c
> # 1 "t.c"
> # 1 "Old/i1.h" 1
> # 1 "Old/i2.h" 1
> # 2 "Old/i1.h" 2
> # 2 "t.c" 2
> OLD
> 
> # 1 "New/i2.h" 1
> # 5 "t.c" 2
> NEW


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]