I believe you need to use #include macro.h, although this might be Intel-specific.
Naomi Greenberg
Member of the Research Staff
Riverside Research Institute
156 William Street
New York, N.Y. 10038
(212) 502-1718 (ph.)
(212) 502-1729 (fax)
[log in to unmask]
________________________________________
From: Fortran 90 List [[log in to unmask]] On Behalf Of Tuan, Hoang-Trong [[log in to unmask]]
Sent: Monday, January 31, 2011 7:15 PM
To: [log in to unmask]
Subject: Using INCLUDE to a file with C-preprocessor in Fortran
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
|