This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Preprocessor statements in 'include'd files
- From: Schamil Wackenhut <sw at wacke dot org>
- To: fortran at gcc dot gnu dot org
- Date: Wed, 17 Jan 2007 16:26:24 +0100
- Subject: Preprocessor statements in 'include'd files
- Reply-to: sw at wacke dot org
Hi,
is it possible to use preprocessor statements in included files?
An example:
a.f:
program hallo
include 'sdf'
#ifdef ASD
write(*,*) 'HalloASD'
#else
write(*,*) 'Hallo'
#endif
end
sdf:
INTEGER sdf
#ifdef ASD
PARAMETER (sdf=1)
#else
PARAMETER (sdf=2)
#endif
So, when i try to compile it with:
gfortran -x f77-cpp-input -DASD a.f
i get following error messages:
Warning: sdf:2: Illegal preprocessor directive
Warning: sdf:4: Illegal preprocessor directive
Warning: sdf:6: Illegal preprocessor directive
In file sdf:5
Included at a.f:2
PARAMETER (sdf=2)
1
Error: PARAMETER attribute conflicts with PARAMETER attribute at (1)
tia & best regards,
schamil
ps: please cc on reply