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.
> Organization: Dept. of Oceanography, Dalhousie University > Keywords: 199502071946.AA10756 Steven, > > These messages indicate some sort of problem with the way you have > > specified to gcc where to find the netCDF library, or problems with the > > installation of that library (was it also built with gcc?). If the `make > > test' worked OK before you installed the netCDF library, you might check how > > gcc was invoked to successfully link nctest.c to the netCDF library and > > imitate that. ... > But I still have the problem with tbl2cdf: > > Skye$ gcc -ansi -o tbl2cdf -I/opt/netcdf/include -L/opt/netcdf/lib -lnetcdf > tbl2cdf.c > [...] > ld: Undefined symbol > _ncclose I think this may just be the order of arguments to gcc. Try the following instead: gcc -ansi -o tbl2cdf -I/opt/netcdf/include tbl2cdf.c -L/opt/netcdf/lib -lnetcdf If that doesn't work, I'm stumped. > I also get similar results when I copy some c++ programs to test the > libraries: > > Skye$ g++ -c -g -I/opt/netcdf/include nctst.cc > Skye$ g++ nctst.o -L/opt/netcdf/lib -lnetcdf -lnetcdf_c++ -o nctst > ld: Undefined symbol > _ncclose > _ncdimdef Here the order of libraries may be important, since the C++ library uses the C library, the C library should probably be last, as in: g++ nctst.o -L/opt/netcdf/lib -lnetcdf_c++ -lnetcdf -o nctst --Russ ______________________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden P.O. Box 3000 http://www.unidata.ucar.edu/ Boulder, CO 80307-3000 ______________________________________________________________________________