Using the FPP Preprocessor

The Fortran preprocessor, FPP, is provided as part of the Intel® Fortran product. When you use a preprocessor for Intel Fortran source files, the generated output files are used as input source files by the Compiler.

Preprocessing performs such tasks as preprocessor symbol (macro) substitution, conditional compilation, and file inclusion. Intel Fortran predefined symbols as described in Predefined Preprocessor Symbols.

The FPP preprocessor can process both free- and fixed-form Fortran source files.

You can explicitly run FPP in these ways:

In addition, the Intel Fortran compiler automatically preprocesses source files that have a filename extension of .fpp, and, on Linux and Mac OS systems, uppercase file extensions of .F, .F90, .FOR, .FTN, or .FPP. For example, the following command preprocesses a source file that contains standard Fortran preprocessor directives, then passes the preprocessed file to the compiler and linker:

ifort source.fpp

If you want to preprocess files that have other Fortran extensions than those listed, you have to explicitly specify the preprocessor.

FPP has some of the capabilities of the ANSI C preprocessor and supports a similar set of directives.  

 The following lists some common cpp features that are supported by fpp as well as common features that are not supported.

Supported cpp features: Unsupported cpp features:
#define, #undef, #ifdef, #ifndef, #if, #elif, #else, #endif, #include, #error, #warning, #line #pragma, #ident
# (stringsize) and ## (concatenation) operators spaces or tab characters preceding the initial "#" character

# followed by empty line

! as negation operator \  backslash-newline

You do not usually need to specify preprocessing for Fortran source programs unless your program uses C-style preprocessing commands, such as those listed above.

If you choose to preprocess your source programs, use the preprocessor fpp, which is the preprocessor supplied with the Intel® Fortran Compiler, or the preprocessing capability of the Fortran compiler. It is recommended that you use fpp.

Caution

Using a preprocessor that does not support Fortran can damage your Fortran code, especially with FORMAT statements. For example, FORMAT (\\I4) changes the meaning of the program because the double backslash "\\" indicates end-of-record with most C/C++ preprocessors.