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 Rich, > We've spent hours on this, so hopefully you can spend 1 minute on this > and provide the answer! ;-) > > Make check shows the tests in nf_test working just fine, but when we > try to compile our own Fortran program > > $ gfortran -o test GRIDinc_Generator.f90 > -I/usr/local/gfortran/include -L/usr/local/gfortran/lib -lnetcdf > > we get lots of statements like: > /usr/local/gfortran/lib/libnetcdf.a(netcdf4.o): In function > `nf90_get_var_any': > /usr/local/netcdf-4.1.1/f90/netcdf4_func.f90:584: undefined reference > to `_nf_get_vars_' > /usr/local/gfortran/lib/libnetcdf.a(netcdf4.o): In function > `nf90_put_var_any': > /usr/local/netcdf-4.1.1/f90/netcdf4_func.f90:562: undefined reference > to `_nf_put_vars_' Is there a separate library installed in /usr/local/gfortran/lib/ named libnetcdff.a (note the double "ff")? If so, you need to use -L/usr/local/gfortran/lib -lnetcdff -lnetcdf to link with both the separate Fortran library and C library. Also, if you installed nc-config along with the other netCDF utilities like ncgen and ncdump, you should look at the output from nc_config --flibs which will show how Fortrna programs should be linked with your installation. If none of these solve the problem, please let us know ... --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: CAF-785846 Department: Support netCDF Priority: Normal Status: Closed