Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

a compile problem

vastviewec
Beginner
2,623 Views
Dear Experts:

I'm currently trying to compile a utilities posted by WRF website which is used for reading netCDF files. However, the compilation failed when I following the instruction provided in the file (the source file is attached.):

[bash]ifort read_wrf_nc.f -L/usr/local/netcdf/lib -lnetcdf -lm -I/usr/local/netcdf/include  -Mfree  -o read_wrf[/bash]

Here are the message I got during the compiling:

[bash]ifort: command line warning #10006: ignoring unknown option '-Mfree'
: error #5149: Illegal character in statement label field  

: error #5149: Illegal character in statement label field  

: error #5149: Illegal character in statement label field  

: error #5149: Illegal character in statement label field  

: error #5149: Illegal character in statement label field  

: error #5118: First statement in file must not be continued

read_wrf_nc.f(187): error #5149: Illegal character in statement label field  
  TYPE proj_info
--^
read_wrf_nc.f(187): error #5149: Illegal character in statement label field  
  TYPE proj_info
---^
read_wrf_nc.f(187): error #5149: Illegal character in statement label field  

TYPE proj_info ----^ read_wrf_nc.f(185): error #5192: Lead underscore not allowed MODULE map_utils ----------^ read_wrf_nc.f(185): error #5082: Syntax error, found IDENTIFIER '_UTILSPROJ_INFO' when expecting one of: ; MODULE map_utils ----------^ read_wrf_nc.f(214): error #5149: Illegal character in statement label field END TYPE proj_info --^ read_wrf_nc.f(214): error #5149: Illegal character in statement label field END TYPE proj_info ---^ read_wrf_nc.f(214): error #5149: Illegal character in statement label field END TYPE proj_info ----^ read_wrf_nc.f(216): error #5149: Illegal character in statement label field CONTAINS -^ read_wrf_nc.f(216): error #5149: Illegal character in statement label field CONTAINS --^ read_wrf_nc.f(216): error #5149: Illegal character in statement label field CONTAINS ---^ read_wrf_nc.f(216): error #5149: Illegal character in statement label field CONTAINS ----^ read_wrf_nc.f(219): error #5149: Illegal character in statement label field SUBROUTINE latlon_to_ij(cdfid, proj, ts_ll, ts_xy ) ---^ read_wrf_nc.f(219): error #5149: Illegal character in statement label field SUBROUTINE latlon_to_ij(cdfid, proj, ts_ll, ts_xy ) ----^ read_wrf_nc.f(266): error #5149: Illegal character in statement label field END SUBROUTINE latlon_to_ij ---^ read_wrf_nc.f(266): error #5149: Illegal character in statement label field END SUBROUTINE latlon_to_ij ----^ read_wrf_nc.f(269): error #5149: Illegal character in statement label field SUBROUTINE llij_ps(lat,lon,proj,i,j) ---^ read_wrf_nc.f(269): error #5149: Illegal character in statement label field SUBROUTINE llij_ps(lat,lon,proj,i,j) ----^ (1606): catastrophic error: Too many errors, exiting compilation aborted for read_wrf_nc.f (code 1) [/bash]

It looks like the problem is associated with the FORTRAN code itself. I have no problem compiling other programmes such as mm5 or wrf. I'm running a Ubuntu 10.04 64bit system. I'm not quite familiar with FORTRAN code and It really confused me. Any suggestion is much appreciated!

Jack
0 Kudos
3 Replies
mecej4
Honored Contributor III
2,623 Views
Do

ifort -help

and choose the compiler switch best matched to what you wanted to do with -Mfree

It is probable that just renaming your file with the extension .f90 and leaving out -Mfree, or, as Tim18 points out below, using -free without renaming the file, is what you need.
0 Kudos
TimP
Honored Contributor III
2,623 Views
ifort doesn't recognize -Mfree unless you leave out the M.
0 Kudos
vastviewec
Beginner
2,623 Views
The problem has been solved. Thanks!
0 Kudos
Reply