Preprocessing Fortran Files

You do not usually preprocess Fortran source programs. If, however, you choose to preprocess your source programs, you must use the preprocessor fpp, or the preprocessing capability of a Fortran compiler. It is recommended to use fpp, which is the preprocessor supplied with the IntelŪ Fortran Compiler.

The compiler driver automatically invokes the preprocessor, depending on the source filename suffix and the option specified. For example, to preprocess a source file that contains standard Fortran preprocessor directives, then pass the preprocessed file to the compiler and linker, enter the following command:

IA-32 applications:

prompt>ifc source.fpp/source.F90

ItaniumŪ-based applications:

prompt>efc source.fpp/source.F90

The .fpp or .F90 file extension invokes the preprocessor. Note the capital F in the file extension to produce the effect.

  Note
Using the preprocessor can make debugging difficult. To get around this, you can save the preprocessed file (-P), and compile it separately, so that the proper file information is recorded for the debugger.

Enabling Preprocessing with CVF

You can enable the Preprocessor for any Fortran file by specifying the -fpp option. With -fpp, the compiler automatically invokes the fpp (preprocessor) to preprocess files with the .f, .ftn, .for or .f90 extension in the mode set by n:

n=0: disable CVF and #directives

n=1: enable CVF conditional compilation and #directives; -fpp1 is the default when the preprocessor is invoked.

n=2: enable only #directives

n=3: enable only CVF conditional compilation directives.

Note
Option -openmp automatically invokes the preprocessor.

String Constants for IA-32 Systems

Intel Fortran fpp conforms to cpp and accepts the cpp style directives. cpp prohibits the use of a string constant value in #if expression. So fpp won't support it either.

#define system "ia32"
#if system == "ia32"
void main() {
printf("ia32\n");
}
#else
int main() {
printf("non ia32\n");
}#endif