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.
>From: address@hidden (Renaud Lestringant) >Organization: Universite Pierre et Marie Curie >Keywords: 200007101445.e6AEjHT12566 netCDF link Renaud, >I am trying to use netcdf on my linux PC (RedHat 6.O version). > >I set up CC=/usr/bin/cc > CFLAGS=-O > FC=g77 > FFLAGS=-O > CPPFLAGS="-Df2cFortran -DNDEBUG" > CXX=/usr/bin/c++ > >I did all the work : configure make (all test install), and, apparently >everything went well. > >I wrote this simple prog.f : > program test_cdf > > implicit none > > include 'netcdf.inc' > > integer ncid, status > > print*, nf_float > > status = NF_CREATE("test.nc", 0, ncid) > status = NF_CLOSE(ncid) > > print*, status > print*, ncid > > end > >and compiled it. > >I got the error message : > >/tmp/ccs2HKSz.o: In function `MAIN__': >/tmp/ccs2HKSz.o(.text+0x49): undefined reference to `nf_create__' >/tmp/ccs2HKSz.o(.text+0x5a): undefined reference to `nf_close__' >collect2: ld returned 1 exit status > > >I can't simply understand what the problem is ? And why ? The undefined reference is telling you that the netCDF entry points nf_create__ and nf_close__ are not being found during the link. It appears, therefore, that you are not including a search of the netCDF library when doing your link, or that you are using the default LD_LIBRARY_PATH for your library search, and the netCDF library got installed in a directory that is not in that LD_LIBRARY_PATH. >I also tried to install netcdf on a dec alpha, and I got no >problem at all (the above prog.f is working) > >So if you have any idea about that I buy it ! Check your LD_LIBRARY_PATH first. If need be, explicitly include a search of libnetcdf.a on your link line. >Thanks >Lestringant renaud >||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|| >|| Renaud LESTRINGANT CNRS Service Aeronomie || >|| address@hidden Universite Pierre et Marie Curie || >|| Phone: +33 01 64474368 Reduit de Verrieres, BP 3 || >|| Fax: +33 01 69202999 91371 Verrieres-le-Buisson Cedex,France|| >||______________________________________________________________________|| Tom Yoksas