preprocessor problem

I am trying to compile a model by PGF90. If I use the compiling command:
/usr/local/pgi/linux86-64/6.1/bin/pgf90 -Mpreprocess -fast -r8 -i8 -mcmodel=medium -Mlarge_arrays -c -Dtype=1 -Dtracer=0 -Dadvection_method=0 -Dbuoy=0 -Dgeostrophy=0 -Dfriction=0 *.f

The error would be:PGF90-S-0021-Label field of continuation line is not blank

If I use the compiling command by extra -Mcpp: /usr/local/pgi/linux86-64/6.1/bin/pgf90 -Mpreprocess -fast -r8 -i8 -mcmodel=medium -Mlarge_arrays -Mcpp -c -Dtype=1 -Dtracer=0 -Dadvection_method=0 -Dbuoy=0 -Dgeostrophy=0 -Dfriction=0 *.f

The error would be:ar: ‘*.o’: No such file. That is , there is no object file existing.

So My question is what flag I should add to the compiling line so that both two errors get solved at one time?

Thank you.

Hi tingting,

“-Mcpp” stops after the preprocessing step and is why your not seeing the error message or getting the “.o” files.

As for error #21 which occurs during compilation, perhaps your using free form? If so, add “-Mfree” to your compilations. If you’re using fixed form, then your post-process file is missing spaces before your continuation line.

As as side note, the extensions “.f” and “.F” tells the compiler you’re using fixed form while “.f90” and “.F90” means free form. Also, if you use an upper case “F” in your file extension, then the file will be preprocessed by default.

  • Mat

Hi, Mat,
Thank you for your fast respond.
I went back and checked the form of the model. The extensions of the fortran file is “.f”, but the code is actually not fixed completedly. I don’t know how the writer of model make it work. But I follow your suggestion and add -Mfree to the compiling. Then the new problem comes out. The pgf90 free form doesn’t recognize comment line beginning with capital C (pgf90 uses !) and the signal of continuation lines (pgf90 uses & at the end of line) in fixed form. Do you think I have to change the code one by one? Or do you think there is a better and easier way to get it work?
Here is the error information.
PGF90-S-0034-Syntax error at or near - (cloud3d_ter.f: 1)
PGF90-S-0034-Syntax error at or near end of line (cloud3d_ter.f: 2)
PGF90-S-0034-Syntax error at or near ‘//’ (cloud3d_ter.f: 3)
PGF90-S-0034-Syntax error at or near end of line (cloud3d_ter.f: 4)
PGF90-S-0034-Syntax error at or near identifier subroutine (cloud3d_ter.f: 5)
PGF90-S-0034-Syntax error at or near identifier this (cloud3d_ter.f: 6)
PGF90-S-0034-Syntax error at or near identifier the (cloud3d_ter.f: 7)
PGF90-S-0034-Syntax error at or near identifier durran (cloud3d_ter.f: 8)
PGF90-S-0034-Syntax error at or near identifier to (cloud3d_ter.f: 9)
PGF90-S-0034-Syntax error at or near identifier the (cloud3d_ter.f: 10)
PGF90-S-0034-Syntax error at or near identifier form (cloud3d_ter.f: 11)
PGF90-S-0034-Syntax error at or near identifier klemp (cloud3d_ter.f: 12)
PGF90-S-0034-Syntax error at or near end of line (cloud3d_ter.f: 13)
PGF90-S-0034-Syntax error at or near identifier this (cloud3d_ter.f: 14)
PGF90-S-0034-Syntax error at or near end of line (cloud3d_ter.f: 15)
PGF90-S-0034-Syntax error at or near - (cloud3d_ter.f: 16)
PGF90-S-0034-Syntax error at or near end of line (cloud3d_ter.f: 17)
PGF90-S-0034-Syntax error at or near identifier input (cloud3d_ter.f: 18)
PGF90-S-0034-Syntax error at or near * (cloud3d_ter.f: 19)
PGF90-S-0034-Syntax error at or near * (cloud3d_ter.f: 20)
PGF90-S-0034-Syntax error at or near identifier s (cloud3d_ter.f: 21)
PGF90-S-0034-Syntax error at or near identifier ns (cloud3d_ter.f: 22)
PGF90-S-0034-Syntax error at or near integer constant 5 (cloud3d_ter.f: 23)
PGF90-S-0034-Syntax error at or near identifier so (cloud3d_ter.f: 24)
PGF90-S-0023-Syntax error - unbalanced parentheses (cloud3d_ter.f: 25)
PGF90-F-0008-Error limit exceeded (cloud3d_ter.f: 25)
PGF90/any Linux/x86-64 6.1-5: compilation aborted

----------------- part of code----------------------------
c------------------------------------------------------------------------------(line 1)
c
c ///////////////////// BEGIN \\\\\\\\\\c \\\\\\\\\\\ SUBROUTINE CLOUD3D ////////////////////
c
c subroutine cloud3d: advance the grid one timestep.
c this is an advective formulation of the model
c The basic formulation follows
c Durran and Klemp MWR 1983 2341-2361 with some modifications
c to the finite differencing. This is a PI-THETA model, with
c the divergence term in the pressure equations being of the
c form ‘(del dot) rho_bar theta_bar V’ → as in DK and
c Klemp and Wilhelmson 1978 JAS.
c
c This version carries full theta
c


Thanks a lot!

Tingting

Hi tingting,

Unfortunately, you can’t mix forms within the same source file. However, instead of using “-Mfree”, try renaming those source file that are in free form to use the “.F90” extension. This way you might need to fix fewer files.

Hope this helps,
Mat