[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 20020603: NETcdf linking errors
- Subject: Re: 20020603: NETcdf linking errors
- Date: Tue, 04 Jun 2002 10:21:49 -0600
>To: address@hidden
>cc: address@hidden
>From: Erik gilje <address@hidden>
>Subject: NETcdf linking errors
>Organization: UCAR/Unidata
>Keywords: 200206031900.g53J0uJ24832
Hi Erik,
> I'm trying to use netcdf in a fortran program on a
> Linux platform. However I keep getting errors that
> seem to be linking errors. This is the error I get:
>
> hot% ln -s /usr/local/src/netcdf-3.5.0/src/f90/netcdf.mod .
> ln: ./netcdf.mod: File exists
That message just indicates that there is already a file (or symbolic
link) named "netcdf.mod" in the current working directory from which
the command was run.
> hot% f90 -c adcirc.cdf.f90
> hot% f90 -o adcirc.cdf adcirc.cdf.o -L/usr/local/src/netcdf-3.5.0/src/lib
> -lnetcdf
>
> Undefined first referenced
> symbol in file
> handle_err_ adcirc.cdf.o
> ld: fatal: Symbol referencing errors. No output
> written to adcirc.cdf
Did you provide a "handle_err" function? That function is not part of
the netCDF library, it's merely used as an example of how you might
choose to handle error returns from netCDF calls. A simple example of
a "handle_err" function is given in the description of the
nf90_strerror() function:
Here is an example of a simple error handling subroutine that uses
NF90_STRERROR to print the error message corresponding to the
netCDF error status returned from any netCDF function call and then
exit:
subroutine handle_err(status)
integer, intent ( in) :: status
if(status /= nf90_noerr) then
print *, trim(nf90_strerror(status))
stop "Stopped"
end if
end subroutine handle_err
That example would just print an error message and stop, but you might
want to handle errors more flexibly, in which case you have to provide
a different version or just test for the error return codes when you
call netCDF routines and handle each one separately ...
--Russ
_____________________________________________________________________
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu