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.
> To: Russ Rew <address@hidden> > From: address@hidden > Subject: Re[4]: 970328: netCDF with C++ on NT > Organization: Hughes > Keywords: 199703282153.OAA22834 Larry, > I spent a little time working the C++ with netCDF 3.3a issue. Here's > what I found: > > The file NcValues.hh contains an enum with 1st item as follows: > "ncNoType = NC_UNSPECIFIED". It appears that NC_UNSPECIFIED is not > part of the external interface. The definition for it is in > /src/libsrc/netcdf.h. I commented out the line "ncNoType = > NC_UNSPECIFIED" in NcValues.hh in order to proceed with the compile. I've appended patches from Glenn Davis for the C++ files to make them work with netCDF 3.3a. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Index: ncvalues.hh =================================================================== RCS file: /upc/share/CVS/netcdf/cxx/ncvalues.hh,v retrieving revision 1.23 diff -c -r1.23 ncvalues.hh *** ncvalues.hh 1996/02/27 21:53:39 1.23 --- ncvalues.hh 1997/04/08 23:18:49 *************** *** 23,28 **** --- 23,30 ---- typedef unsigned char ncbyte; + #define NC_UNSPECIFIED ((nc_type)0) + enum NcType { ncNoType = NC_UNSPECIFIED, *************** *** 166,171 **** --- 168,175 ---- return (short) the_values[n]; \ } + #define NCLONG_MIN INT_MIN + #define NCLONG_MAX INT_MAX #define as_nclong_implement(TYPE) \ nclong NcVal(TYPE)::as_nclong( long n ) const \ { \ Index: netcdf.cc =================================================================== RCS file: /upc/share/CVS/netcdf/cxx/netcdf.cc,v retrieving revision 1.70 diff -c -r1.70 netcdf.cc *** netcdf.cc 1996/07/02 16:03:15 1.70 --- netcdf.cc 1997/04/08 23:14:49 *************** *** 294,310 **** return the_id; } ! NcFile::NcFile( const char * path, FileMode mode ) { NcError err(NcError::silent_nonfatal); // constructor must not fail ! switch (mode) { ! case ReadOnly: case Write: the_id = ncopen(path, mode); in_define_mode = 0; break; case New: case Replace: the_id = nccreate(path, mode); in_define_mode = 1; --- 294,316 ---- return the_id; } ! NcFile::NcFile( const char * path, FileMode fmode ) { NcError err(NcError::silent_nonfatal); // constructor must not fail ! int mode = NC_NOWRITE; ! ! switch (fmode) { case Write: + mode = NC_WRITE; + /*FALLTHRU*/ + case ReadOnly: the_id = ncopen(path, mode); in_define_mode = 0; break; case New: + mode = NC_NOCLOBBER; + /*FALLTHRU*/ case Replace: the_id = nccreate(path, mode); in_define_mode = 1; Index: netcdf.hh =================================================================== RCS file: /upc/share/CVS/netcdf/cxx/netcdf.hh,v retrieving revision 1.56 diff -c -r1.56 netcdf.hh *** netcdf.hh 1996/02/21 16:26:57 1.56 --- netcdf.hh 1997/04/08 23:10:50 *************** *** 35,44 **** virtual ~NcFile( void ); enum FileMode { ! ReadOnly = NC_NOWRITE, // file exists, open read-only ! Write = NC_WRITE, // file exists, open for writing ! Replace = NC_CLOBBER, // create new file, even if already exists ! New = NC_NOCLOBBER // create new file, fail if already exists }; NcFile( const char * path, FileMode = ReadOnly ); --- 35,44 ---- virtual ~NcFile( void ); enum FileMode { ! ReadOnly, // file exists, open read-only ! Write, // file exists, open for writing ! Replace, // create new file, even if already exists ! New // create new file, fail if already exists }; NcFile( const char * path, FileMode = ReadOnly );