The include preprocessor directive allows you to retrieve source statements from secondary input files and incorporate them into your program.
There are two ways you can control the disk directories searched by the compiler when it looks for include files.
Path Fully Qualified
When the compiler encounters either a user or system
include file directive with a fully qualified file name (full
path and filename), it looks only in the directory specified by
the name.
Path Not Fully Qualified (User include Files)
When the compiler encounters a user include file specification
that is not fully qualified, it searches for the file in the
following places, in order:
Path Not Fully Qualified (System include Files)
When the compiler encounters a system include file specification
that is not fully qualified, it searches for the file in the
following places, in order:
Accumulation of Options
The include search options are cumulative between the
ICC and INCLUDE environment variables and the command
line. For example, given the following ICC and
INCLUDE environment variables:
ICC=/I\roseanne INCLUDE=c:\kent;\alan
and the following command line:
icc /Xi+ /Ic:\connie test.c /Xi- /Xc /Id:\dal f:\moe\marko\jay.c
The include files are processed as follows:
User include files
Any user include files referenced in test.c are searched for
first in the current directory, then in the directory \rosanne,
and then in c:\connie. Because of the /Xi- option, none of the
directories in INCLUDE are searched.
Any user include files referenced in jay.c are searched for in the following directories, in the given order: f:\moe\marko, d:\dal, c:\kent, and \alan. The directories in INCLUDE are searched because the /Xi- option overrides the /Xi+ option specified previously. The /Xc option removes the directories \roseanne and c:\connie from the current search path.
System include files
Any system include files referenced in the file test.c are
searched for first in the directory \roseanne and then in the
directory c:\connie. Because of the /Xi+ option, none of the
directories in INCLUDE are searched.
Any system include files referenced in the file f:\moe\marko\jay.c will be searched for first in the d:\dal directory, then in the c:\kent directory, and finally the \alan directory. The directories in INCLUDE are searched because the /Xi- option overrides the /Xi+ option specified previously. The /Xc option removes the directories \roseanne and c:\connie from the current search path.
![]()
Environment Variables for Compiling