### Question 10.8

Where are header (```#include`'') files searched for?

The exact behavior is implementation-defined (which means that it is supposed to be documented; see question 11.33). Typically, headers named with `<>` syntax are searched for in one or more standard places. Header files named with `""` syntax are first searched for in the ``current directory,'' then (if not found) in the same standard places.

Traditionally (especially under Unix compilers), the current directory is taken to be the directory containing the file containing the `#include` directive. Under other compilers, however, the current directory (if any) is the directory in which the compiler was initially invoked. Check your compiler documentation.

References: K&R2 Sec. A12.4 p. 231
ANSI Sec. 3.8.2
ISO Sec. 6.8.2
H&S Sec. 3.4 p. 55

Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995 // mail feedback