Share via


/I   (Additional Include Directories)

OverviewHow Do ICompiler Options

The Additional Include Directories option (/Idirectory) adds one or more directories to the list of directories searched for include files. Directories are searched only until the specified include file is found. You can use this option with the Ignore Standard Include Paths (/X) option.

In the Project Settings dialog box, use a comma to separate directories to be searched when entering more than one directory. (To find this option in the development environment, click Settings on the Project menu. Then click the C/C++ tab, and click Preprocessor in the Category box.)

On the command line, a space between /I and directory is optional. To search more than one directory, type one /I option for each directory.

The compiler searches for directories in the following order:

  1. Directories containing the source file.

  2. Directories specified with the /I option, in the order that CL encounters them.

  3. Directories specified in the INCLUDE environment variable.

Example

The following command looks for the include files requested by MAIN.C in the following order: first in the directory containing MAIN.C, then in the \INCLUDE directory, then in the \MY\INCLUDE directory, and finally in the directories assigned to the INCLUDE environment variable.

CL /I \INCLUDE /I\MY\INCLUDE MAIN.C