Specifies an additional search path for #include filenames that do not specify an absolute path.


Read syntax diagramSkip visual syntax diagram>>- -I--directory----------------------------------------------><


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.

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.

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.


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

Related information