another suggested patch for c++

After much work and tire spinning, we (Steve Matheson, actually)
finally have the g++ parts of netcdf working here at Dalhousie
Oceanography.  Many thanks are owed to many kind folks who helped us.

In particular, the c++/nctst program works fine.

But when I tried c++/example (a better skeleton for my actual
requirements) it failed to compile, e.g. I got

  g++ -o example -I/opt/netcdf/include example.cc -L/opt/netcdf/lib 
-lnetcdf_c++ -lnetcdf
  example.cc: In function `int main()':
  example.cc:10: `Clobber' is not a member of type `NcFile'
  example.cc:10: in base initialization for class `NcNewFile'
  example.cc:15: warning: `return' with no value, in function returning non-void
  *** Error code 1

The following patch fixes two errors in c++/example.cc.  Can they
please be incorporated into the newest patch (5, I think) for netcdf?
(I'm presuming here that we have properly installed patches 3 and 4,
evidence for which is the fact that we've got c++/nctst to work ok.)
I'm posting this patch to help other folks in the meantime.



Dan E. Kelley                   internet:                Dan.Kelley@xxxxxx
Oceanography Department         phone:                       (902)494-1694
Dalhousie University            fax:                         (902)494-2885
Halifax, NS, CANADA, B3H 4J1    WWW:  http://www.phys.ocean.dal.ca/~kelley

******** patch follows ***********************



*** /local/po/netcdf/src/netcdf-232pl4/c++/example.cc   Wed Feb  1 14:02:23 1995
--- ./example.cc        Wed Feb  8 10:56:23 1995
***************
*** 7,18 ****
  main( void )
  {
      const char* path = "example.nc";
!     NcNewFile nc (path, NcFile::Clobber); // Create and leave in define mode
  
      // Check if the file was opened
      if (! nc.is_valid()) {
        cerr << "can't create netCDF file " << path << "\n";
!       return;
      }
  
      // Create dimensions
--- 7,18 ----
  main( void )
  {
      const char* path = "example.nc";
!     NcNewFile nc (path, NcNewFile::Clobber); // Create and leave in define 
mode
  
      // Check if the file was opened
      if (! nc.is_valid()) {
        cerr << "can't create netCDF file " << path << "\n";
!       return 0;
      }
  
      // Create dimensions






  • 1995 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: