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: address@hidden >From: "Matt Kennedy" <address@hidden> >Subject: netcdf C++ >Organization: NOAA/NOS/OCS >Keywords: 200312181532.hBIFWSp2006768 netCDF C++ Hi Matt, > I am attempting to complite a netcdf C++ program with g++ (gcc version > 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) with netcdf installed > (netcdf-3.5.0-2.7.3) and I am getting a number of errors. > > I added friend to three class definitions which is common to the groups. > > Compliing with... > g++ -Wno-deprecated drouge.cpp > > netcdfcpp.h exists and is in /usr/include, here is my code... > > #include <netcdfcpp.h> > > NcFile *nooch = new NcFile("200312081100_C3PO_fieldsfore.nc"); > > And it can't seem to find the library nonethless here is the error. > > ......../tmp/ccOz21AL.o(.text+0x36): In function `main': > : undefined reference to `NcFile::NcFile[in-charge](char const*, > NcFile::FileMode, unsigned*, unsigned)' > collect2: ld returned 1 exit status > > What am I missing here??? Running Redhat 9 on intel... Please try the netcdf-3.5.1-beta release: ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-beta.tar.Z which has fixes for some problems, including updates to the C++ interface for more recent C++ compilers. Just follow the instructions in the INSTALL document, which includes several examples of environment variable settings for Linux: http://www.unidata.ucar.edu/packages/netcdf/INSTALL.html#linux If it still doesn't work, please send details to address@hidden as described in the "Reporting Problems" section of the INSTALL document: http://www.unidata.ucar.edu/packages/netcdf/INSTALL.html#ReportingProblems Thanks. --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu/staff/russ