#define in include file

Dear All,

I am trying to compile my code having an include file. In the include file some variables and terms have been defined for example as:


define INT2 integer*2

define ZERO 0.0

but for some ? reason, it seems that the compiler does not recognizes the #define command and gives error while using the variables throughout the FORTRAN files.

I appreciate your help in advance,


Hi Sarvin,

-Mpreprocess will preprocess and compile your fortran code. Make sure you use #include to include file.

program test
#include “myinc.inc”

!other code


Hi Hongyon,

I appreciate your reply.

and would you please let me know what you mean by Mpreprocess and how I can apply it in Compaq Visual Fortran. Yes,indeed I have #include filename.inc command in all the subroutines and the main code.

I appreciate your help,


Hi Sarvin,

It is the command use by for pgf90/pgf77/pgf95 , The Portland Group Fortran compilers.

We have PVF (PGI Visual Fortran) for windows, which incorporated our compilers into Microsoft Visual Studio.

-Mpreprocess would apply only to PGI compilers.

To download the product go to our download page at: http://www.pgroup.com/support/downloads.php