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

[netCDF #STA-212689]: netCDF C/C++ library



Hi Thomas,

> I have downloaded and installed the latest version of the netCDF
> library. I have been trying to compile a C code found on
> http://www.unidata.ucar.edu/software/netcdf/examples/programs/ and
> have recieved the following error message: 
> 
> <thfo@wlsn094: CORRECTION/Source> c++ pres_temp_4D_wr.c -o 
> ../pres_temp_4D_wr.exe -I/users/sgsys/thfo/libraries/src/netcdf-4.0.1/libsrc/ 
> -L/users/sgsys/thfo/libraries/lib/ -lnetcdf_c++
> Undefined                       first referenced
> symbol                             in file
> nc_put_var_float                    /var/tmp/ccbWm7RH.o
> nc_create                           /var/tmp/ccbWm7RH.o
> nc_enddef                           /var/tmp/ccbWm7RH.o
> nc_close                            /var/tmp/ccbWm7RH.o
> nc_def_dim                          /var/tmp/ccbWm7RH.o
> nc_def_var                          /var/tmp/ccbWm7RH.o
> nc_put_vara_float                   /var/tmp/ccbWm7RH.o
> nc_strerror                         /var/tmp/ccbWm7RH.o
> nc_put_att_text                     /var/tmp/ccbWm7RH.o
> ld: fatal: Symbol referencing errors. No output written to 
> ../pres_temp_4D_wr.exe
> collect2: ld returned 1 exit status
> 
> Please note that if I try compiling the code again, the "ccbWm7RH.o"
> will have changed to something else. 
> 
> I have been trying to sort out this for 2 days now but haven't been
> able to understand why it's doing this. 

The C++ library calls the C library for netCDF, so you need to add

  -lnetcdf

after -lnetcdf_c++ when you are using static libraries.

--Russ

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



Ticket Details
===================
Ticket ID: STA-212689
Department: Support netCDF
Priority: Normal
Status: Closed