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 Ahmed, > I am using netcdf 4.1.2 and i have compiled it with gfortran and i > am trying to compile program which is using netcdf libraries > > gfortran read_smart.f90 -L /usr/local/netcdf_412_gfortran/lib/ -lnetcdff > -lnetcdf -I /usr/local/netcdf_412_gfortran/include/ > > but when i type a.out , i get the following error > > a.out: symbol lookup error: a.out: undefined symbol: __netcdf_MOD_nf90_open > > i have compile netcdf with the following option > ./configure FC=gfortran CC=gcc --prefix=/usr/local/netcdf_412_gfortran/ > --enable-shared ; > and i do make check and all test is passed ok and i have attached it in the > mail > for me i don't what where is the error. Move the gfortran include option to before the f90 file name, as in: gfortran -I /usr/local/netcdf_412_gfortran/include read_smart.f90 -L /usr/local/netcdf_412_gfortran/lib -lnetcdff -lnetcdf so the compiler knows where to look for the netcdf.mod file referenced in the f90 "use netcdf" statement in your read_smart.f90 program. You can also use the "nc-config" command to see what Fortran flags are needed on your systems, as in nc-config --fflags and nc-config --flibs where nc-config is a command installed in the netcdf bin/ directory, along with ncdump, ncgen, and nccopy utilities. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: IPF-540532 Department: Support netCDF Priority: Normal Status: Closed