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.
> Problem: When compiling NetCDF4 snapshot2008021202 using Gnu C/C++ and > Portland Group F95 in Redhat Enterprise Linux (v4), "make check" failed > after an otherwise successful build. I've attached the relevant output, but > note that I solved the problem by changing > > #include <netcdf.h> > to > #include "netcdf.h" > > in every *.c file in the libsrc4 directory that contained a call to include > the netcdf.h header file. > > The problem is that the GCC preprocessor considers the current directory (in > this case libsrc4) to be a "system" directory with regard to header file > search paths. This means that the preprocessor removes any instances of > "-I.", or "-I../libsrc4" from the search path, because it intends to search > the current directory anyway, but only after all non-system, user-specified > directories had been searched. > > The problem, as you might imagine, is that another copy of netcdf.h resides > in the directory libsrc (note the lack of a "4"), which does not contain the > necessary header information for compiling the files in libsrc4. By > changing the angle brackets to quotation marks, the GCC preprocessor no > longer considers the copy of netcdf.h residing in libsrc4 to be a system > header, so it gets found according to the rules you guys set using multiple > "-I" options to GCC (namely, you place libsrc4 before libsrc in the header > file search path). > > After implementing this change, all of "make check" passed with flying > colors, and I seem to have a working installation of NetCDF4. If you can > think of a strong argument against this change, please reply. Thanks! > > -Josh Rigler > > Howdy Josh! This is not the correct answer to the problem you are having. If you want me to try and sort out the problem, I need the output of "make check" for a clean build, without the changes in the code files. Then we can figure out why it is not working for you... THanks, Ed Ticket Details =================== Ticket ID: TIB-359748 Department: Support netCDF Priority: Normal Status: Closed