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.
Rasmus, >Date: Fri, 05 Jun 1998 12:36:34 +0000 >From: "Rasmus E. Benestad" <address@hidden> >Organization: Det Norske Meteorologiske Institutt >To: address@hidden >Subject: Problems with linking the netCDF library on an SGI R5000 >Keywords: 199806051238.GAA04999 In the above message, you wrote: > I apologise for taking your time. I have tried for some time to install > netCDF on my SGI 02 work station, but I have some problems getting the > libraries to work. The installation seems to complete, and ncdump and > ncgen work. The problems arise when I try to use the netCDF libraries > when compiling C codes for reading or writing netCDF files. I tried a > simple C program generated by using ncdump data.nc > foo.cdl; ncgen -c > foo.cdl > foo.c. > > The errors that I get are: > > saragasso 53% make foo > cc -ansi -g -mips3 -o foo -I//usr/people/kareb/local/include > -L//usr/people/kareb/local/lib foo.c > ld32: ERROR 33: Unresolved text symbol "nc_strerror" -- 1st referenced > by foo.o. > ld32: ERROR 33: Unresolved text symbol "nc_create" -- 1st referenced by > foo.o. > ld32: ERROR 33: Unresolved text symbol "nc_def_dim" -- 1st referenced by > foo.o. > ld32: ERROR 33: Unresolved text symbol "nc_def_var" -- 1st referenced by > foo.o. > ld32: ERROR 33: Unresolved text symbol "nc_put_att_text" -- 1st > referenced by foo.o. > ld32: ERROR 33: Unresolved text symbol "nc_put_att_float" -- 1st > referenced by foo.o. > ld32: ERROR 33: Unresolved text symbol "nc_put_att_short" -- 1st > referenced by foo.o. > ld32: ERROR 33: Unresolved text symbol "nc_enddef" -- 1st referenced by > foo.o. > ld32: ERROR 33: Unresolved text symbol "nc_put_var_float" -- 1st > referenced by foo.o. > ld32: ERROR 33: Unresolved text symbol "nc_put_var_short" -- 1st > referenced by foo.o. > ld32: ERROR 33: Unresolved text symbol "nc_close" -- 1st referenced by > foo.o. > ld32: INFO 152: Output file removed because of error. > *** Error code 2 (bu21) ... The above error messages indicates that the linker could not resolve references to netCDF functions. This is consistent with the fact that the above compile-and-link command does not reference the netCDF library. You must add a reference to the netCDF library to your compile-and-link command, for example cc -ansi -g -mips3 -o foo -I/usr/people/kareb/local/include \ -L/usr/people/kareb/local/lib -lnetcdf foo.c > > The lines in my Make file are: > > CC = cc > NCDF=-I/$(HOME)/local/include -L/$(HOME)/local/lib -lnetcdf > . > . > foo: foo.c > $(CC) -ansi -g -mips3 -o foo $(NCDF) foo.c From the above, it would appear that the make(1) command should have contained a reference to the netCDF library. Yet we know from the output that it did not. It appears that your make(1) utility is broken. Try compiling-and-linking the file manually to investigate the problem. If you succeed manually but make(1) refuses to add the netCDF library reference, then inform your system administrator of the problem. > > I had a similar problem when using the HDF (4.3) library, but managed > still to get the code to compile if I used the -u flag. This trick, > however, didn't work for the netCDF library. Do you have any idea of > what I'm doing wrong? Are the libraries not properly installed, or is it > that I do something wrong when compiling/linking foo.c? Could it be that > ncgen is not working properly? > > Yours sincerely Rasmus Benestad > address@hidden Please let me know if this helps. -------- Steve Emmerson <http://www.unidata.ucar.edu>