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, > I'm trying to compile the simplest example with more than one unlimited > dimention: > > #include <netcdfcpp.h> > int main() > { > NcFile dataFile("dataFile.nc", NcFile::Replace, 0, NcFile::Netcdf4); > NcDim* ncTime = dataFile.add_dim("Time"); > NcDim* ncNDim = dataFile.add_dim("Number"); > return 0; > } > > I use library version 4.1.1, compile program with > g++ main.cpp -o exe -lnetcdf_c++ -lnetcdf > but still get a error "NetCDF: NC_UNLIMITED size already in use". > > What am I doing wrong? The C++ interface included in the 4.1.1 distribution by default only handles the netCDF-3 "classic" data model, which only permits a single unlimited dimension per file. To build the new experimental netCDF-4 C++ interface contributed by Lynton Appel, you need to use the configure option "--enable-cxx-4". The documentation for this new interface is here: http://www.unidata.ucar.edu/software/netcdf/docs/cxx4/ We expect an improved version of the C++ netCDF-4 interface will be available when netCDF version 4.1.2 is released, in the next month or so. --Russ --with-netcdf Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: CZY-526815 Department: Support netCDF Priority: Normal Status: Closed