Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Why don't nested #include's start at the source directory?
Message-ID: <1989Dec12.172009.25073@utzoo.uucp>
Organization: U of Toronto Zoology
References: <49549@bbn.COM>
Date: Tue, 12 Dec 89 17:20:09 GMT

In article <49549@bbn.COM> jgrace@BBN.COM (Joe Grace) writes:
>Is this behavior generally broken or am I missing something?

The problem is that K&R1 was not entirely explicit about how things happened
when #includes got nested.  Some compilers look for #include "..." in the
directory of the first source file, some look for it in the directory of
the current source file.  (ANSI C just says that it is implementation-defined,
with a strong hint in the Rationale that first-source-file behavior is
preferred.)  The only portable way to deal with the situation, insofar as
there is one, is to use #include <...> and -I to get the rules you want.
-- 
1755 EST, Dec 14, 1972:  human |     Henry Spencer at U of Toronto Zoology
exploration of space terminates| uunet!attcan!utzoo!henry henry@zoo.toronto.edu
