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.
Hi, > 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