The
XL C compiler
supports the following types of include files:
- Header files supplied by the compiler (referred to throughout
this document as XL C headers)
- Header files mandated by the C standard (referred to throughout this
document as system headers)
- Header files supplied by the operating system (also referred to
throughout this document as system headers)
- User-defined header files
You can use any of the following methods to include any type of
header file:
- Use the standard #include <file_name> preprocessor
directive in the including source file.
- Use the standard #include "file_name" preprocessor
directive in the including source file.
- Use the -qinclude compiler option.
If you specify the header file using a full (absolute) path name,
you can use these methods interchangeably, regardless of the type
of header file you want to include. However, if you specify the header
file using a relative path name, the compiler uses a different
directory search order for locating the file depending on the method
used to include the file.
Furthermore, the
-qidirfirst and
-qstdinc compiler
options can affect this search order. The following summarizes the
search order used by the compiler to locate header files depending
on the mechanism used to include the files and on the compiler options
that are in effect:
- Header files included with -qinclude only: The compiler
searches the current (working) directory from which the compiler is
invoked.1
- Header files included with -qinclude or #include
"file_name": The compiler searches the directory in
which the including file is located.1
- All header files: The compiler searches each directory specified
by the -I compiler option, in the order that it displays on
the command line.
- All header files: The compiler searches the standard directory for
the XL C headers. The default directory for these headers is specified
in the compiler configuration file. This is normally /opt/IBM/xlc/13.1.0/include. But the search path can be changed
with -qc_stdinc compiler option.
- All header files: The compiler searches
the standard directory for the system headers. The default directory
for these headers is specified in the compiler configuration file.
This is normally /usr/include/. But the search path can be changed
with -qc_stdinc .
Note: - If the -qidirfirst compiler option is in effect, step 3
is performed before steps 1 and 2.
- If the -qnostdinc compiler option is in effect, steps 4
and 5 are omitted.