Preprocess Phase

Preprocessing performs such tasks as preprocessor symbol (macro) substitution, conditional compilation, and file inclusion. The compiler preprocesses files as an optional first phase of the compilation. Source files that have a filename extension of .fpp, .F, .F90, .FOR, .FTN, or .FPP are automatically preprocessed by the compiler. 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 another extension, you have to explicitly specify the preprocessor.

You do not usually need to specify preprocessing for Fortran source programs. The preprocessor is necessary only if your program uses C-style preprocessing commands, such as #if, #define, and so forth.

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

If you want to use another preprocessor, you must invoke it before you invoke the compiler.

fpp conforms to cpp and accepts the cpp-style directives. cpp (and thus fpp) prohibit the use of a string constant value in an #if expression.

You can use the Preprocessor Options on the command line to direct the operations of the preprocessor.


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 backslash "\" indicates end-of-record.