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 Michael, It's important to know whether the library you installed from a package manager was just compiled with the C interface or also included a Fortran interface. It's possible to build the netCDF library for use only with C and C++ by specifying a --disable-fortran flag to the configure script when building the library. You can find out whether the library includes the Fortran interface by running a command like nm -a /usr/lib/libnetcdf.a | grep nf_open The output should include a line such as 00000830 T nf_open_ (the address will be different) that indicates the entry "nf_open_" is included in the library. If there is no output, the library doesn't contain the Fortran interfaces to netCDF. If the library does contain the Fortran interfaces, you will need to use a Fortran compiler that matches the conventions used when the library was built for calling C functions from Fortran subroutines. If the library was built with g95 or g77 and you use gfortran, the conventions may not match, so gfortran would complain that it couldn't find the functions. An indication that you are using a different Fortran compiler than was used to build the library would be the appearance of a different number of trailing underscores in the names of functions in the library, for example if the output from running the command above included names with 2 trailing underscores, such as: 00000830 T nf_open__ There may be flags to gfortran that allow an adjustment to be made, but it may just be easier to build the netCDF library from source. On Ubuntu, this may be as easy as just invoking ./configure make check sudo make install to install the package in /usr/local. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: NQR-841821 Department: Support netCDF Priority: Normal Status: Closed