/I (Additional include directories)
Adds a directory to the list of directories searched for include files.
The directory to be added to the list of directories searched for include files.
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 (/X (Ignore Standard Include Paths)) option.
The compiler searches directories in the following order:
If specified using a #include directive in double-quote form, it first searches local directories. The search begins in the same directory as the file that contains the #include statement. If this fails to find the file, it searches in the directories of the currently opened include files, in the reverse order in which they were opened. The search begins in the directory of the parent include file and continues upward through the directories of any grandparent include files.
If specified using a #include directive in angle bracket form, or if the local directory search has failed, it searches directories specified by using the /I option, in the order that CL encounters them on the command line.
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 Working with Project Properties.
Select the Configuration Properties > C/C++ > General property page.
Modify the Additional Include Directories property.
To set this compiler option programmatically
The following command looks for the include files requested by MAIN.c in the following order: First, if specified by using double-quotes, local files are searched. Next, search continues 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
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.