Preprocessing Fortran Source Files

Tobias Burnus burnus@net-b.de
Thu Apr 12 17:49:00 GMT 2007


Browder, Tom wrote:
> Hm, g95, sgi, and NAG seem to make it work.  Maybe a change to cpp:
> Fortran language specifics; or maybe use Sun's fpp?
>   

SGI I cannot test, g95 indeed works, but NAG, SUN and ifort don't work.

What speaks against using   #include "..."  instead of  include '...' ?

Tobias


With NAG f95 I'm really surprised that it works for you because it does
not do so here:

$ tar xfz ../preprocbug.tgz
$ f95 -V
NAGWare Fortran 95 compiler Release 5.1(346)
$ f95 -fpp hello.f
Error: hello.cmn: Invalid #line directive

g95 indeed works:

$ g95 -cpp hello.f

ifort as said does not:

$ ifort -cpp hello.f
fortcom: Warning: ./hello.cmn, line 1: Bad # preprocessor line
#if defined(USE_GFORTRAN)
$ ifort -v
Version 9.1

And SUN does not work neither:

$ sunf95 -V
sunf95: Sun Fortran 95 8.3 Linux_i386 Build35_2 2006/12/04
$ sunf95 -fpp hello.f

#if defined(USE_GFORTRAN)
^
"hello.cmn", Line = 1, Column = 1: ERROR: The characters found in the
label field are not valid.



More information about the Fortran mailing list