Include
Code
from
Another
File
Directive
#include
Syntax
#include
"filename"
or
#include
<filename>
Description
The #include directive tells the preprocessor
to
read source statements from
another file. The preprocessor includes (at the
point
in the code where
#include
is
encountered) the contents
of
the filename,
which
are
then
pro-
cessed. You can enclose the filename in double quotes or in angle brackets.
The
filename can be a complete path name or a filename
with
no path
in-
formation.
CD
If
you provide path information
for
filename, the preprocessor uses
that path and does
not
look
for the file in any other directories.
o
If
you
do
not
provide path information and you enclose the filename
in
double
quotes,
the preprocessor searches for the file in:
1)
The directory that contains the current source file. (The current
source file refers
to
the file
that
is
being processed
when
the
preprocessor encounters the #include directive.)
2)
Any
directories named
with
the
-i
preprocessor option.
3)
Any
directories named
with
the
C-DIR
environment variable.
(i)
If
you
do
not
provide path information and you enclose the filename
in
angle
brackets,
the preprocessor searches
for
the file in:
1)
Any
directories named
with
the -i preprocessor option.
2) Any directories named
with
the
C-DIR
environment variable.
Note:
If
vou enclose the filename in angle brackets, the preprocessor
d'1es
not
search
tor
the file in the current direc'
For more information about the -i option and the environment variable, read
Section 3.1.3 on page
3-4.
8-5