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.
Hello, It looks like there might be a runtime problem; try setting the LD_LIBRARY_PATH environmental variable to /usr/local/lib, e.g. $ export LD_LIBRARY_PATH=/usr/local/lib This tells the linker where to find the shared libraries at runtime. If this doesn't work, what is the output when you run nc-config --all ? Thanks! -Ward >/ Hi! > > I have some problems with netcdf library and i hope you can help me > > I use Ubuntu 16.04. I am trying to run the sample in C to read data with > netCDF program > > https://www.unidata.ucar.edu/software/netcdf/examples/programs/ > > and i have the next error: > > simple_xy_rd.c:(.text+0x2f): undefined reference to `nc_open' > simple_xy_rd.c:(.text+0x4b): undefined reference to `nc_strerror' > simple_xy_rd.c:(.text+0x80): undefined reference to `nc_inq_varid' > simple_xy_rd.c:(.text+0x9c): undefined reference to `nc_strerror' > simple_xy_rd.c:(.text+0xd4): undefined reference to `nc_get_var_int' > simple_xy_rd.c:(.text+0xf0): undefined reference to `nc_strerror' > simple_xy_rd.c:(.text+0x19e): undefined reference to `nc_close' > simple_xy_rd.c:(.text+0x1ba): undefined reference to `nc_strerror' > collect2: error: ld returned 1 exit status > > I thought maybe he's not properly linking the library, so I tried the > next line to see where the netcdf.h is : > > nc-config --cflags > > -I/usr/local/include > > I tried to compile the file with the next code : > > gcc -Wall -I/usr/local/include -c simple_xy_rd.c -o simple_xy_rd > > It doesn't show any error but It creates an object that is not executable. > > Before installing netcdf I installed the packages zlib and hdf5-1.8.10-patch1 > as recommended. zlib pacakage did not present any problem. When I used "make" > it present the following message: > Makefile:553: recipe for target 'h5tools_str.lo' failed > make[2]: *** [ h5tools_str.lo ] Error 1 > make[2]: Leaving directory > '/home/gnaro/Descargas/hdf5-1.8.10-patch1/tools/lib' > Makefile:497: recipe for target 'all-recursive' failed > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory '/home/ gnaro/Descargas/hdf5-1.8.10-patch1 /tools' > Makefile:539: recipe for target 'all-recursive' failed > make: *** [all-recursive] Error 1 > I thank you for any help you can give me > > Best regards > > Genaro Soriano > > Ticket Details =================== Ticket ID: LYS-656454 Department: Support netCDF Priority: Normal Status: Closed =================== NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.