This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Is this correct? (contradicting includes)
- To: Martin Kahlert <martin dot kahlert at infineon dot com>
- Subject: Re: Is this correct? (contradicting includes)
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Thu, 23 Aug 2001 19:02:27 +0100
- Cc: gcc at gcc dot gnu dot org
- References: <20010823125220.A2812@keksy.muc.infineon.com>
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