Programming in *.f90 free format with PETSc

Satish Balay balay at mcs.anl.gov
Thu Aug 9 22:34:29 CDT 2007


On Fri, 10 Aug 2007, Ben Tay wrote:

> The strange thing is when I try to compile on my windows's visual
> fortran, it gives lots of error. The errors all point to mpif.h. Some errors
> are:
> 
> d:\cygwin\codes\MPICH\SDK\include\mpif.h(1) : Error: Syntax error, found
> END-OF-STATEMENT when expecting one of: ( : % . = =>
> C
> -^
> d:\cygwin\codes\MPICH\SDK\include\mpif.h(2) : Error: Syntax error, found
> END-OF-STATEMENT when expecting one of: ( : % . = =>
> C
> -^
> d:\cygwin\codes\MPICH\SDK\include\mpif.h(3) : Error: Syntax error, found
> INTEGER_CONSTANT '1993' when expecting one of: ( % . = =>
> C  (C) 1993 by Argonne National Laboratory and Mississipi State University.
> -------^

Some f90/free-form compilers don't like 'C' for comments. They need
'!' in the first columns.

To fix this - you'll have to follow instructions from mpif.h

>>>>>>>>>

C It really is not possible to make a perfect include file that can
C be used by both F77 and F90 compilers, but this is close.  We have removed
C continuation lines (allows free form input in F90); systems whose
C Fortran compilers support ! instead of just C or * for comments can
C globally replace a C in the first column with !; the resulting file
C should work for both Fortran 77 and Fortran 90.
C
C If your Fortran compiler supports ! for comments, you can run this 
C through sed with
C     sed -e 's/^C/\!/g'

<<<<<<<<<<<<

Satish




More information about the petsc-users mailing list