/I (Additional Include Directories)
Adds a directory to the list of directories searched for include files.
/I[ ]directory
Arguments
- directory
The directory to be added to the list of directories searched for include files.
Remarks
To add more than one directory, use this option more than once. Directories are searched only until the specified include file is found.
You can use this option with the Ignore Standard Include Paths (/X (Ignore Standard Include Paths)) option.
The compiler searches for directories in the following order:
Directories containing the source file.
Directories specified with the /I option, in the order that CL encounters them.
Directories specified in the INCLUDE environment variable.
To set this compiler option in the Visual Studio development environment
Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.
Click the C/C++ folder.
Click the General property page.
Modify the Additional Include Directories property.
To set this compiler option programmatically
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