Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Use Include Files

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

The compiler searches 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* only)

  5. In the directories specified with environment variables CPATH (Linux*) 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.

Specify and Remove 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, ifx.cfg (or 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

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

Windows

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

See Also