Print

Print


I have a number of preprocessors, which are commonly used by multiple Fortran sources. 

Instead of adding this to every Fortran source file, and every time I want to change a setting, I need to modify at different files.

#ifndef INCLUDED_MACRO_H

#define INCLUDED_MACRO_H 1


#define _LINEAR_FORM 1
#define _3D_FORM 2
  ! use linear form for now
#define _MEMORY_LAYOUT_ _LINEAR_FORM


#define _FIXED_BOUNDARY 0
#define _EULER_BOUNDARY 1
#define  _BOUNDARY_CONDITION_  _FIXED_BOUNDARY

#endif

I want to move them to a single file, name macro.h
and then in each source file, I add add

include "macro.h"

However, the Fortran compiler (particularly PGI Fortran), keep giving me the error when I use "-Mpreprocess". If I use -Mcpp, it only generate a corresponding .f file from the Fortran source file, Is there a better way to make INCLUDE statement work.

Thank you,
Tuan