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 Bob, The examples are all compiled and run when "make check" is invoked in building netCDF version 3.6.2 and later snapshots. In particular, you should see something like the following in the output from "make check": ... make[3]: Entering directory `/shecky/n362_test/examples/CXX' *** SUCCESS writing example file simple_xy.nc! PASS: simple_xy_wr *** SUCCESS reading example file simple_xy.nc! PASS: simple_xy_rd *** SUCCESS writing example file sfc_pres_temp.nc! PASS: sfc_pres_temp_wr *** SUCCESS reading example file sfc_pres_temp.nc! PASS: sfc_pres_temp_rd *** SUCCESS writing example file pres_temp_4D.nc! PASS: pres_temp_4D_wr *** SUCCESS reading example file pres_temp_4D.nc! PASS: pres_temp_4D_rd *** Testing that CXX examples produced same files as C examples. *** checking simple_xy.nc... *** checking sfc_pres_temp.nc... *** checking pres_temp_4D.nc... *** All CXX example comparisons worked! ... Output from building and testing netCDF 3.6.2 on a Linux system using g++, showing the above examples worked, is here: http://www.unidata.ucar.edu/software/netcdf/builds/3_6_2/nc3_make_distcheck_out.txt The way the compilers are invoked in the output from make check is pretty complicated, but for me this is all that's necessary, assuming I have installed netCDF in /usr/local/ : g++ -I/upc/netcdf/include pres_temp_4D_wr.cpp -o pres_temp_4D_wr \ -L/upc/netcdf/lib -lnetcdf_c++ -lnetcdf If you get a bunch of undefined symbols when you do this, maybe your library was built with a different compiler than g++. Unfortunately, libraries built with different C++ compilers are not necessarily interoperable, due to different "name mangling" schemes for creating the names of overloaded methods. The C++ interface is supported. In the future we will be upgrading it to support Exceptions, namespaces, and templates, based on some work a student did for us this summer. You should be able to use all PGI comp[ilers for building netCDF, if you don't want to use GNU compilers. --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: XXC-119083 Department: Support netCDF Priority: Normal Status: Closed