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.
> Thanks so much for your help regarding this matter. I have gotten the > netcdf-fortran API installed, but my application that is trying to use it > is complaining about undefined references to a series of calls. You only need to add another loader option, "-lnetcdff", to make the compiler look in the Fortran library as well as the C library. So where you now have "-lnetcdf", substitute "-lnetcdff -lnetcdf". > ... I remember > running into something similar to this a year ago with a previous netcdf > install, and it had to do something with the number of > underscores proceeding a function call? Here is a portion of the errors I > got when attempting to compile in blue below; see attachment for the full > makelog. I am rather novice when dealing with installation issues. Is > there a linux command I could use to search for functions within my netcdf > library; for instance "netcdf_MP_nf90_create"? To determine if this is a > underscore issue? Although it's not the solution to this issue, you can use the "nm" command to list the names of symbols in an object file, such as a library. To see what external symbols include the string "nf90_create" in /opt/lib/libnetcdff.a, for example, you could use $ nm -g /opt/lib/libnetcdff.a | grep nf90_create 00000000000401c0 T __netcdf_MOD_nf90_create 00000000000404a0 T __netcdf_MOD_nf90_create_mp --Russ > Some additional information This is netcddf 4.2. I > have successfully installed both netcdf c and fortran APIs. I am using g95 > and gcc as my compliers. The code I am attempting to install is a 1D > version of the Noah land surface model (it has been well tested and should > work). > > Let me know if you need any other information. > > Thanks, > > g95 -o driver.exe module_sf_noahmplsm.o module_model_constants.o > module_sf_myjsfc.o module_sf_sfclay.o module_sf_noahlsm.o module_ascii_io.o > module_netcdf_io.o module_io.o kwm_date_utilities.o module_sf_noahutl.o > driver.o -L/home/ronnieleeper/prgs/netcdf/lib -lnetcdf > module_netcdf_io.o: In function > `module_netcdf_io_MP_initialize_netcdf_output': > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:58: > undefined reference to `netcdf_MP_nf90_create' > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:61: > undefined reference to `netcdf_MP_nf90_def_dim' > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:64: > undefined reference to `netcdf_MP_nf90_def_dim' > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:68: > undefined reference to `netcdf_MP_nf90_def_dim' > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:73: > undefined reference to `netcdf_MP_nf90_def_dim' > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:78: > undefined reference to `netcdf_MP_nf90_def_dim' > module_netcdf_io.o:/home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:83: > more undefined references to `netcdf_MP_nf90_def_dim' follow > module_netcdf_io.o: In function > `module_netcdf_io_MP_initialize_netcdf_output': > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:90: > undefined reference to `netcdf_MP_nf90_put_att_one_fourbytereal' > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:93: > undefined reference to `netcdf_MP_nf90_put_att_one_fourbyteint' > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:96: > undefined reference to `netcdf_MP_nf90_put_att_one_fourbyteint' > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:99: > undefined reference to `netcdf_MP_nf90_put_att_one_fourbyteint' > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:102: > undefined reference to `netcdf_MP_nf90_put_att_one_fourbyteint' > /home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:105: > undefined reference to `netcdf_MP_nf90_put_att_one_fourbyteint' > module_netcdf_io.o:/home/ronnieleeper/noah-mp1D/Simple-Driver-NoahMP-v1.0/module_netcdf_io.f:108: > more undefined references to `netcdf_MP_nf90_put_att_one_fourbyteint' follow > module_netcdf_io.o: In function > `module_netcdf_io_MP_initialize_netcdf_output': Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: XUG-723381 Department: Support netCDF Priority: Normal Status: Closed