When you imbed one source file in another using the #include preprocessor directive, you must supply the name of the file to be included. You can specify a file name either by using a full path name or by using a relative path name.
The full path name, also called the absolute path name, is the file's complete name starting from the root directory. These path names start with the / (slash) character. The full path name locates the specified file regardless of the directory you are presently in (called your working or current directory).
The following example specifies the full path to file mine.h in John Doe's subdirectory example_prog:
/u/johndoe/example_prog/mine.h
The relative path name locates a file relative to the directory that holds the current source file or relative to directories defined using the -Idirectory option.
C and C++ define two versions of the #include preprocessor directive. IBM XL C/C++ supports both. With the #include directive, the include filename is enclosed between either the < > or " " delimiter characters.
Your choice of delimiter characters will determine the search path used to
locate a given include filename. The compiler will search for that
include file in all directories in the search path until the include file is
found, as follows:
#include type | Directory Search Order |
#include <file_name> |
|
#include "file_name" |
|
Notes:
Use the -qnostdinc option to search only the directories specified with the -Idirectory option and the current source file directory, if applicable.
Use the -qidirfirst option with the #include "file_name" directive to search the directories specified with the -Idirectory option before searching other directories.
Use the -I option to specify the directory search paths.
I
c_stdinc
cpp_stdinc
gcc_c_stdinc
gcc_cpp_stdinc
idirfirst
stdinc