Compiler
Operation
-
Preprocessor
Description
3.1.3
Specifying
Alternate
Directories
for
Include
Files
The
#include
preprocessor directive tells the preprocessor
to
read source
statements from another
file. The syntax for this directive is:
#include
"filename"
or
#include
<filename>
The filename names
an
include file that the preprocessor reads statements
from; you can
enclose the filename in
double
quotes or in angle brackets. The
filename can be a
complete pathname or a filename
with
no path information.
• If you provide path information
for
filename, the preprocessor uses that
path and does
not
look
for the file in any other directories.
• 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 set
with
the environment variable
C-DIR.
Note
that
if
you enclose the filename in angle brackets, the preprocessor
does
not
search
for
the file in the current directory.
C/!)
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 pre-
processor encounters the
#include
directive.)
2)
Any
directories named
with
the
-i
preprocessor option.
3)
Any
directories set
with
the environment variable
C-DIR.
You can augment the preprocessor's directory search algorithm
by
using the
-i preprocessor
option
or the environment variable
C-DIR.
3.1.3.1
-i
Preprocessor
Option
3-4
The -i preprocessor option names
an
alternate directory that contains include
files. The format
of
the
-i
option
is:
gspcpp
-ipathname
You can use up
to
10
-i
options per invocation; each
-i
option
names one
pathname.
In C source, you can use the #include directive
without
specifying
any path information for the
file; instead, you can specify the path information
with
the -i option. For example, assume
that
a file called
source.
c
is
in the
current directory;
source.
c contains the
following
directive statement:
#include
"alt.c"
The table
below
lists the complete path name
for
alt.
c and
shows
how
to
invoke the preprocessor; select the
row
for
your
operating system.