# Use Include Files

Include files are brought into a program with the `#include` preprocessor directive or a Fortran INCLUDE statement.

Directories are searched for include files in this order:

1. In the directory of the source file that contains the include

2. In the current working directory

3. In the directories specified by compiler option I.

4. In the directory specified by compiler option -isystem (Linux* and macOS only)

5. In the directories specified with environment variables CPATH (Linux* and macOS) or INCLUDE (Windows*)

6. In the standard system directories

The locations of directories to be searched are known as the include file path. More than one directory can be specified in the include file path.

## Specifying and Removing an Include File Path

You can use compiler option I to indicate the location of include files (and also module files).

To prevent the compiler from searching the default path specified by the CPATH or the INCLUDE environment variable, use compiler option -X or /noinclude.

You can specify these options in the configuration file, ifort.cfg, or on the command line.

For example, to direct the compiler to search a specified path instead of the default path, use the following command:

Linux

    ifort -X -I/alt/include newmain.f

Windows

    ifort /noinclude /IC:\Project2\include newmain.f

Parent topic: Program Structure

## See Also

I compiler option
INCLUDE statement
isystem compiler option
X compiler option