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 Rob, > I'm currently trying to get some ocean modelling software working which > I have downloaded (NEMO - http://www.nemo-ocean.eu/) that uses NetCDF. > I've been running into a lot of trouble with it, as I am compiling it. > > I am trying to build the model with gfortran using Ubuntu 12.04. The > 'USE netcdf' commands within the Fortran files are processing without > errors, but the references to netcdf within the code are giving errors > such as this: > > histcom.f90:(.text+0x203): undefined reference to `__netcdf_MOD_nf90_redef' > > Am I correct in thinking that this is because the 'netcdf.mod' file that > I have in my 'usr/includes/' folder is compiled using a different > compiler to gfortran? If so, what would you recommend that I do? I have > tried various ways of re-configuring the netcdf files but so far with no > success. Yes, using a different Fortran compiler (or in some cases just a different version of the same Fortran compiler) changes the .mod file format. You will either have to use the same compiler that was used to build the netCDF Fortran library, or rebuild and reinstall the netCDF Fortran library with the same compiler you're using for your application. > Also, if it is possible for me to rebuild this, is it just the > 'netcdf.mod' file in the 'usr/includes/' folder that needs to be replaced? You would have to rebuild the netCDF Fortran library, but you may be able to keep using the same netCDF C library that's already installed, depending on how old the C library version is and whether it was built as a shared library or not. Here's the instructions for getting the netCDF Fortran library and rebuilding it by telling it where the netCDF C library is installed: http://www.unidata.ucar.edu/netcdf/docs/netcdf-fortran-install.html If you also need to get and build the netCDF C library, instructions for that are here, under the "Getting" and "Building" links: http://www.unidata.ucar.edu/netcdf/docs/ --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: YPM-575307 Department: Support netCDF Priority: Normal Status: Closed