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

Re: netCDF xdr_ symbols

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: Re: netCDF xdr_ symbols
  • Date: Tue, 20 Aug 1996 16:49:55 -0600

> Date: Fri, 16 Aug 1996 14:42:24 -0600
> From: address@hidden (Aaron Lai)
> To: address@hidden, address@hidden
> Subject: netCDF xdr_ symbols

Hi Aaron,

>    I got a program from NCAR/CGD called 'gennet.for'.  They told me that
> after I compile it and link with netCDF library I will be able to excute
> it with input of the netCDF filename and get a FORTRAN program to read
> the netCDF file.
> 
>    I tried to compile and link with the netCDF library installed by the
> system manager of my local SUN network.  It gave me an error message:
> 
> gennet.f:
>  MAIN:
> Undefined                       first referenced
>  symbol                             in file
> xdr_enum                            ../lib/libnetcdf.a(array.o)
> xdr_float                           ../lib/libnetcdf.a(cdf.o)
> xdr_int                             ../lib/libnetcdf.a(array.o)
> xdr_vector                          ../lib/libnetcdf.a(sharray.o)
> xdr_u_long                          ../lib/libnetcdf.a(array.o)
> xdr_double                          ../lib/libnetcdf.a(cdf.o)
> xdr_long                            ../lib/libnetcdf.a(dim.o)
> xdr_opaque                          ../lib/libnetcdf.a(array.o)
> ld: fatal: Symbol referencing errors. No output written to a.out

I think you only need to add "-lnsl" to the link command to get the Sun
XDR functions.  If you look at how any of the other netCDF programs
(ncdump, ncgen, nctest, ftest) are linked on the Sun when you build them
with "make all" and "make test", I think you'll find that they all use
"-lnsl" on Sun's to access the XDR library.  For example:

  f77 -o ftest ftest.o -L../libsrc -lnetcdf -lnsl

is used to link the Fortran test program "ftest".

Please let us know if this doesn't solve the problem.

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu