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

Maik Beckmann beckmann.maik@googlemail.com
Wed Jun 10 21:37:00 GMT 2009


Steve Kargl schrieb am Mittwoch 10 Juni 2009 um 23:23:

> -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

Thanks you for this explanations.  This makes using the regular gcc cpp  not 
an options for me, since I know this kind of // concats are used a lot in our 
code.


Thanks,
 -- Maik



More information about the Fortran mailing list