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.
> Dear NetCDF support, > > I've been having problems compiling the simple test files you've provided > on your website using my current Fortran compiler - GFortran. I get an > error each time saying that netcdf.mod is unable to be found. As I believe > I've installed netcdf correctly up to this point (from the binaries), I'm > attributing the problem to NetCDF being unfamiliar with my compiler > (and/or vice versa). Would you be able to recommend a free, easily > downloadable and reliable compiler (capable of compiling Fortran 90/95 > code) for use with NetCDF please? > > Many thanks, > Steve Murray > > > -- > > > Howdy Steve! gfortran works just fine with netCDF. In fact, it is what I use every night for automatic testing. And if the tests from "make check" succeeded, then we know it works on your machine as well. Where are the .mod files? They should be in /usr/local/include if you did not provide a --prefix argument when you ran the netCDF configure script. With gfortran, I believe that one uses the -I option, as I see from the documentation (below). You need to pass this argument, with the location of your mod files: 4.5 Options for Directory Search ================================ There options affect how affect how `gfortran' searches for files specified via the `INCLUDE' directive, and where it searches for previously compiled modules. It also affects the search paths used by `cpp' when used to preprocess Fortran source. `-IDIR' These affect interpretation of the `INCLUDE' directive (as well as of the `#include' directive of the `cpp' preprocessor). Also note that the general behavior of `-I' and `INCLUDE' is pretty much the same as of `-I' with `#include' in the `cpp' preprocessor, with regard to looking for `header.gcc' files and other such things. This path is also used to search for `.mod' files when previously compiled modules are required by a `USE' statement. Let me know if this helps. Thanks! Ed Ticket Details =================== Ticket ID: GMM-276241 Department: Support netCDF Priority: High Status: Closed