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.
Hello Judy, I think I see what's going on; you are passing the core C library to the linker via `-lnetcdf`, but you also need to link against the Fortran interface library, via `-lnetcdff`. Try adding `-lnetcdff` to the end of your gfortran invocation, and let me know if the issue persists! Thanks, I hope this helps, have a great day, -Ward > Full Name: Judy Gaukel > Email Address: address@hidden > Organization: Scripps Institution of Oceanography > Package Version: Fortran 4.5.0-development > Operating System: CentOS > Hardware: x86 > Description of problem: $gfortran -I/usr/local/netcdf-fortran/fortran -o > test test.f -L/usr/local/lib -lnetcdf > /tmp/cchTr4fh.o: In function `MAIN__': > test.f:(.text+0x104): undefined reference to `nccre_' > test.f:(.text+0x11f): undefined reference to `ncendf_' > test.f:(.text+0x137): undefined reference to `ncclos_' > collect2: error: ld returned 1 exit status > ls /usr/local/netcdf-fortran/fortran -- has netcdf.inc and netcdf.mod (and > all that other stuff)... > ls /usr/local/lib has > libnetcdff.a libnetcdff.la libnetcdff.so libnetcdff.so.6 > libnetcdff.so.6.1.1 libnetcdf.so libnetcdf.so.11 libnetcdf.so.11.2.0 > pkgconfig > > So I am baffled - why doesn't it seem to compile? > > > Ticket Details =================== Ticket ID: QVX-141521 Department: Support netCDF Priority: Normal Status: Closed