Option Type | Default Value | #pragma options | C | C++ |
-flag | - | - | x | x |
Syntax
-Idirectory
Purpose
Specifies an additional search path if the file name in the #include
directive is not specified using its absolute path name.
Notes
The value for directory must be a valid path name (for
example, /u/golnaz, or /tmp, or
./subdir). The compiler appends a slash (/)
to the directory and then concatenates it with the file name
before doing the search. The path directory is the one that the
compiler searches first for #include files whose
names do not start with a slash (/). If
directory is not specified, the default is to search the standard
directories.
The normal search order is:
If the -I directory option is specified both in the configuration file and on the command line, the paths specified in the configuration file are searched first.
When all specified directories have been searched, the directories on the standard list for #include files are searched. The directories on the standard list differ for the two versions of the #include directive. See Directory Search Sequence for Include Files Using Relative Path Names for more information about searching directories.
The -I directory option can be specified more than once on the command line. If you specify more than one -I option, directories are searched in the order that they appear on the command line.
If you specify a full (absolute) path name on the #include directive, this option has no effect.
Example
To compile myprogram.c and search /usr/tmp and
then /oldstuff/history for included files,
enter:
xlC myprogram.c -I/usr/tmp -I/oldstuff/history
List of Compiler Options and Their
Defaults
idirfirst Compiler Option