/I - Search Directory for Include Files (Windows CE 5.0)
This option adds to the list of directories searched for #include files.
/Idirectory
The space between /I and directory is optional.
The search process for included files can involve three stages.
It begins with the #include directive:
- If the file specified to the #include directive contains a complete drive and path specification, that file is included without searching any directories.
- If the specified file is enclosed in double quotation marks, the directory of the file containing the #include directive is searched.
- If the current file is also an include file, the directory of the parent file is searched until the original source files directory is searched.
The second stage uses the /I option. If the file is still not found or if it is specified to the #include directive in angle brackets, a directory specified by an /I command-line option is searched.
To search more than one directory, give additional /I options on the compiler command line, using one /I option for each directory. Separate multiple /I options with spaces.
The compiler searches multiple directories in the order of their appearance on the command line until it finds the specified include file.
The third stage involves the INCLUDE environment variable. If the file is not found in a directory specified by an /I option, a directory or path specified in the INCLUDE environment variable is used.
If the include file is not found, the compiler prints an error message and stops processing. When this occurs, you must restart compilation with a corrected directory specification.
The following code example shows how to make the compiler look for the include files requested by Main.c in the following order: first, in the directory \Include, then, in the directory \My\Include, and finally, in the directory or directories assigned to the INCLUDE environment variable.
CL /I \INCLUDE /I\MY\INCLUDE MAIN.C
See Also
Send Feedback on this topic to the authors