-I

Category

Input control

Pragma equivalent

None.

Purpose

Adds a directory to the search path for include files.

Syntax

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

Defaults

See Directory search sequence for include files for a description of the default search paths.

Parameters

directory_path
The path for the directory where the compiler should search for the header files.

Usage

If -nostdinc or -nostdinc++ (-qnostdinc) is in effect, the compiler searches only the paths specified by the -I option for header files, and not the standard search paths as well. If -qidirfirst is in effect, the directories specified by the -I option are searched before any other 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.

The -I option has no effect on files that are included using an absolute path name.

Predefined macros

None.

Examples

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


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us