Imports text from a specified file.
Syntax
INCLUDE character-literal-constant |
- character-literal-constant
is the name of the file to include.
Description
The keyword INCLUDE and character-literal-constant form an INCLUDE line, which is used to insert text into a program
prior to compilation. The inserted text replaces the INCLUDE line; the INCLUDE line should therefore appear in your program where
you want the inserted text. When the end of an included file is
reached, the compiler continues processing with the line following
the INCLUDE line.
character-literal-constant can be either a file name or a device name. It must
not have a kind parameter that is a named constant.
The INCLUDE line must appear on one line with no other text
except possibly a trailing comment. It should not have a statement
label. Thus, you cannot branch to it, and it cannot be an action
statement that is part of a Fortran 90 IF statement. You cannot use the “;” operator to add a second INCLUDE line, nor can you use the “&” operator to continue it over another
line.
The
compiler searches directories for the named include files in the
following order:
The current source directory
Directories specified by the -I compile-line option, in the order specified
The current working directory
The directory /usr/include
INCLUDE lines can be nested to a maximum of ten levels.
However, they must be nested nonrecursively. That is, inserted text
must not specify an INCLUDE line that was encountered at an earlier level
of nesting.
Line numbering within the listing of an included file begins
at 1. When the included file listing ends, the include level decreases
appropriately, and the previous line numbering resumes.
Examples
INCLUDE 'my_common_blocks' INCLUDE ”/my_stuff/declarations.h” |
Related concepts
For related information, see the following: