Why don't nested #include's start at the source directory?

David desJardins desj at idacrd.UUCP
Wed Dec 13 04:48:53 AEST 1989


>From article <49549 at bbn.COM>, by jgrace at bbn.com (Joe Grace):
> I have found a surprising, annoying and disappointing "feature" of
> both /lib/cpp (SunOS3.5) and GNU cpp:
> 
>   ./bar/1.h:
>   #include "2.h"

   The behavior looks perfectly correct to me.  The meaning of the
file 1.h should not depend on where you compile it from.  Looking at
the file by itself, obviously the place to look for 2.h is in the
directory where 1.h is found.  If you want it to find 2.h in the ..
directory, then write #include "../2.h".

   -- David desJardins



More information about the Comp.lang.c mailing list