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 James, When compiling your program, try passing the '-lnetcdff' argument to gfortran, e.g. $ fortran -I /home/james/local/include sdfsd.F90 -L /home/james/local/lib -lnetcdf -lnetcdff -o sdfsd This should address the undefined fortran references. Let me know if this doesn't work, or if you have any further questions. -Ward > Full Name: James Brooke > Email Address: address@hidden > Organization: University of Leeds > Package Version: Fortran 4.4.2 > Operating System: Linux Debian Wheezy > Hardware: > Description of problem: > > Hi, I have installed the NetCDF libraries on my Linux machine, and I > thought I have done it correctly. However, when attempting to run a > simple program, for all of the NetCDF functions that it calls, I get: > > sdfsd.F90:(.text+0x684f6): undefined reference to `nf_inq_var_' > sdfsd.F90:(.text+0x6855d): undefined reference to `nf_strerror_' > sdfsd.F90:(.text+0x685e3): undefined reference to `nf_inq_dim_' > sdfsd.F90:(.text+0x6864a): undefined reference to `nf_strerror_' > sdfsd.F90:(.text+0x686e3): undefined reference to `nf_get_vara_real_' > > etc... > > I downloaded netcdf-fortran-4.4.2.tar.gz, netcdf-4.3.3.1.tar.gz, and > followed the instructions at > > http://www.unidata.ucar.edu/software/netcdf/docs/getting_and_building_netcdf.html#build_classic, > > under "Building with netCDF-4 and the Remote Data Client". I downloaded > the three other packages and installed them and the NetCDF-C package > as directed, using "home/james/local" as the installation directory in > all cases. All of the checks showed nothing but oks and passes. Then I > installed the fortran package following: > > http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-fortran-install.html, > > where I made sure that the library path was set as told, again got passes. > > When I try to compile a program with > > gfortran -I /home/james/local/include sdfsd.F90 -L /home/james/local/lib > -lnetcdf -o sdfsd > > it gives the above errors, and doesn't seem to be finding the libraries > at all. Do you have any idea what could be causing this? Please et me > know if there's any more specific information I can give you. Also, > if I could just get the package the easy way, I would like to, but it > doesn't seem to be in the debian repository. If you know how I could > get it, please let me know as well. > > Thank you very much for you help, > > James > > Ticket Details =================== Ticket ID: ZFY-843585 Department: Support netCDF Priority: Normal Status: Closed