[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20050405: problem using UDUNITS with Fortran code

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: 20050405: problem using UDUNITS with Fortran code
  • Date: Wed, 06 Apr 2005 14:46:32 -0600

Yuanchong,

>Date: Wed, 6 Apr 2005 15:51:38 -0400 (EDT)
>From: Yuanchong Zhang <address@hidden>
>Organization: Columbia University/NASA GISS
>To: address@hidden (Steve Emmerson)
>Subject: Re: 20050405: problem using UDUNITS with Fortran code
> Keywords: 200504051922.j35JM9v2005883

The above message contained the following:

>       The following are 
>    (1) Fortran compiling error message (the fortran program 11.f is successful
>       on SGI machine, on which somebody intalled UDUNITS at /usr/...)
>    (2) udunits.inc file
> 
>       Please help diagnose what problem really is. Thank you
> 
> Yuanchong
> --------------------(1) ----------------------------------------
> 
> Script command is started on Wed Apr  6 15:42:04 EDT 2005.CLYXZ@FURTUNA: 
> /d1b/rad> ff.nc11 11.f
> xlf  -O3   11.f  astsub.o -qextname -L/usr/local/netcdf-3.4/lib -lnetcdf 
> -L/d1b/rad/ncep/Ying/udunits-1.11.7/lib -ludunits
> "/d1b/rad/ncep/udunits-1.11.7/include/udunits.inc", line 27.7: 1515-022 (S) 
> Syntax Error: Extra token " fptrfineptrinteger " was found. The token is 
> ignored.

It looks like the Fortran compiler is not correctly preprocessing the 
"udunits.inc" file with the C preprocessor.  It looks like it failed on
the "#define" in that file.

Your options are

    1.  Remove the "#include <udunits.inc>" from the source file, 11.f.
        If you do this, then you will have to declare all the
        UDUNITS functions yourself in the file "11.f".

    2.  See if there's an option to the xlf(1) compiler that will
        ensure that it uses the C preprocessor; or

    3.  Try renaming the input file, 11.f, to "11.F".  Sometimes a
        capital "F" extension gets different behavior from the
        preprocessor.

Regards,
Steve Emmerson