preprocessor token "#" doesn't work in gfortran as in gcc, intel-fortran or sun-fortran compiler

Steve Kargl sgk@troutmask.apl.washington.edu
Wed Jun 10 21:23:00 GMT 2009


On Wed, Jun 10, 2009 at 02:12:27PM -0700, Tim Prince wrote:
> Steve Kargl wrote:
> > On Wed, Jun 10, 2009 at 10:29:16PM +0200, Maik Beckmann wrote:
> ...
> >>
> >> ifort and sunf95 both take 
> >>   -fpp
> >> to preprocess a source file while gfortran wants 
> >>  -cpp
> .....
> >> No show stoppers at all, but inconvenient.
> >>
> > 
> > Have you asked Intel and Sun to support the gfortran
> > syntax and feature?
> > 
> >From ifort -help:
> -fpp[n], -[no]fpp
>            run Fortran preprocessor on source files prior to compilation
                 ^^^^^^^^^^^^^^^^^^^^

-cpp with gfortran invokes the C preprocessor.  gfortran does not
have a separate preprocessor designed to work with Fortran.  You've
already hinted at the problem for Maik.

troutmask:sgk[213] cat a.F90
print *, 'Hello' // ' world!'
end
troutmask:sgk[214] gfc4x -cpp -o z a.F90
troutmask:sgk[215] ./z
 Hello world!
troutmask:sgk[216] cpp -std=c99 a.F90
# 1 "a.F90"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.F90"
print *, 'Hello'
end
troutmask:sgk[217] cpp -std=c89 a.F90
# 1 "a.F90"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.F90"
print *, 'Hello' // ' world!'
end

-- 
Steve



More information about the Fortran mailing list