By default, the compiler uses Berkeley UNIX search rules,
so source files and
#include header files are
searched for relative to the current place.
The current place is the directory containing the source or header
file currently being processed by the compiler.
When a file is found relative to an element of the search
path, the directory containing that file becomes the new current
place. When the compiler has finished processing that file, it restores the
previous current place. At each instant there is a stack of current
places corresponding to the stack of nested
For example, if the current place is the include directory
and the compiler is seeking the include file
...\include\sys\defs.h if it exists.
When the compiler begins to process
the current place becomes
file included by
defs.h that is not specified
with an absolute path name, is searched for relative to
The original current place
restored only when the compiler has finished processing
You can disable the stacking of current places by using the
--kandr_include. This option makes
the compiler use Kernighan and Ritchie search rules whereby each
#include is searched for relative
to the directory containing the source file that is being compiled.
- Other information
Kernighan, B.W. and Ritchie, D.M., The C Programming Language (2nd edition, 1988). Prentice-Hall, Englewood Cliffs, NJ, USA. ISBN 0-13-110362-8.