HP C/iX Reference Manual (31506-90011)
Chapter 7 101
Preprocessing Directives
Recommendations for Using Include Files
Recommendations for Using Include Files
If you have include files or source files spread throughout your file system, you may want
to become familiar with the following recommendations for arranging include files in a
flexible and consistent manner. However, if you keep all source and include files in a single
group and account on your system, the recommendations listed below may not be useful to
you.
There is no best way to arrange include files on a system but there are practices to follow
that make the use of include files simple and efficient for most cases. Include file searching
for standard files enclosed by angle brackets is fully described in chapter 8. The following
recommendations are for include file names enclosed by double quotes.
• Put include files in the same group and account as the source file with which they are
associated. This is the default search place for files that are not fully qualified and for
qualified files that are not found in the first try.
• If you have standard files to be shared by source files in the same account but in
different groups, put them in the H group of the source file's account. Be aware that if
source files specify file.h for these standard files, a FILE equation command is
required to open any file other than file.h.srcacct. Consequently, this is the first file
opened by the preprocessor because the account of the source file is implied before any
-I options are examined.
• Use the -I option to tell the preprocessor where to find include files that are not in the
exact group or the H group of the source file's account. Qualify the -I option with group
and account if you want searches in the account of the source file. Omit the account
specification only if you want searches made in the account of the current user, as you
might when using job files that log on in other accounts.
• If you want to override the defaults for a single include file, or small subset of include
files, use MPE/iX's FILE command to equate the file that is opened by the preprocessor
to the file that you want to use. Use the rules for include file searching to determine
exactly what file the preprocessor opens and use that fully qualified name in the file
equation.
Examples
For the source file FILE1.MYGRP.OURACCT that needs a special header file called MYDEFS,
put MYDEFS in MYGRP.OURACCT and use:
#include "MYDEFS"
in FILE1.MYGRP.OURACCT . The name MYDEFS.H in the include statement also works, as
does putting the MYDEFS file in H.OURACCT, but neither of those choices reflects the
intended use of the file MYDEFS.
If you want to substitute the file FIXDEFS for MYDEFS when compiling
FILE1.MYGRP.OURACCT in the above example, use the file equation:
:FILE MYDEFS.MYGRP.OURACCT = FIXDEFS