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.
Akaïwoung, > I apply what you suggest without success. > The same error appear. I'm sorry to hear that. Another possible problem that has the same symptom is that the library you got using apt-get either did not include the Fortran interface (for example, it could have been built with the --disable-fortran configure option), or it was built with a different Fortran compiler than the gfortran you have installed on your system. You could get around these errors by just building the library from source and installing that on your system. It's pretty easy to build from source, especially if you don't need the DAP remote client or the HDF5 support required for the netCDF-4 data model. It sounds like you don't need those capabilities for converting NCEP/NCAR netcdf data to binary data. In that case, you could just follow the "Quick Instructions for Installing NetCDF on Unix" that are here: http://www.unidata.ucar.edu/netcdf/docs/netcdf-install.html#Quick-Instructions --Russ > > Netcdf is installed on my computer (Kubuntu 64, 10.04) using apt-get. > > I am trying to convert NCEP/NCAR netcdf data to binary data using this > > command > > > > gfortran -I/usr/include -L/usr/lib -lnetcdf netcdf2binary.f > > > > I get the following errors > > > > > > /tmp/ccQkmOJO.o: In function `MAIN__': > > netcdf2binaryA.f:(.text+0x28f): undefined reference to `nf_open_' > > netcdf2binaryA.f:(.text+0x304): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0x3b3): undefined reference to `nf_inq_varid_' > > netcdf2binaryA.f:(.text+0x428): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0x474): undefined reference to `nf_inq_varid_' > > netcdf2binaryA.f:(.text+0x4e9): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0x535): undefined reference to `nf_inq_varid_' > > netcdf2binaryA.f:(.text+0x5aa): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0x5f9): undefined reference to `nf_inq_varid_' > > netcdf2binaryA.f:(.text+0x66e): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0x6ba): undefined reference to `nf_inq_varid_' > > netcdf2binaryA.f:(.text+0x72f): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0x7dc): undefined reference to `nf_get_var_real_' > > netcdf2binaryA.f:(.text+0x851): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0x8ae): undefined reference to `nf_get_att_real_' > > netcdf2binaryA.f:(.text+0x923): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0x97d): undefined reference to `nf_get_att_real_' > > netcdf2binaryA.f:(.text+0x9f2): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0xa3e): undefined reference to `nf_get_var_real_' > > netcdf2binaryA.f:(.text+0xab3): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0xaff): undefined reference to `nf_get_var_real_' > > netcdf2binaryA.f:(.text+0xb74): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0xbc3): undefined reference to `nf_get_var_real_' > > netcdf2binaryA.f:(.text+0xc38): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0xc84): undefined reference to `nf_get_var_real_' > > netcdf2binaryA.f:(.text+0xcf9): undefined reference to `nf_strerror_' > > netcdf2binaryA.f:(.text+0xd37): undefined reference to `nf_close_' > > netcdf2binaryA.f:(.text+0xdac): undefined reference to `nf_strerror_' > > collect2: ld returned 1 exit status > > > > There is any way to correct it? > > Try changing the order of the arguments to gfortran to: > > gfortran -I/usr/include netcdf2binary.f -L/usr/lib -lnetcdf > > because the library references should appear after the source file names. > > --Russ > > > > Russ Rew UCAR Unidata Program > address@hidden http://www.unidata.ucar.edu > > > > Ticket Details > =================== > Ticket ID: XRT-704709 > Department: Support netCDF > Priority: Normal > Status: Closed > > > > > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: XRT-704709 Department: Support netCDF Priority: Normal Status: Closed