NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

netcdf 3.5.0 c++ interface

 Hello there,
 I get stucked with some warnings about old-style includes and some
 minor bugs about c++ interface using gnu compiler > 3.2, so (at least
 tested on linux) I do contribute a little patch to be applied on
 linux systems using gnu compiler > 3.2.
 It works with gcc 3.2 on SuSE 8.1.

 Cheers,
                  Graziano.

                             \ | /
                             (@ @)
 -------------------------o00-(_)-00o -----------------------------
 Graziano Giuliani
 University of L'Aquila
 Department of Electrical Engineering - CETEMPS
 Monteluco di Roio, 67040 L'Aquila, Italy
 Tel. +39 08623475309     Fax. +39 08623475210
 mailto: graziano.giuliani@xxxxxxxxxxxxxx
diff -r -C2 netcdf-3.5.0.dist/src/configure netcdf-3.5.0/src/configure
*** netcdf-3.5.0.dist/src/configure     2001-03-22 21:43:12.000000000 +0000
--- netcdf-3.5.0/src/configure  2003-03-07 15:29:46.000000000 +0000
***************
*** 1229,1238 ****
  #line 1230 "configure"
  #include "confdefs.h"
! #ifdef __cplusplus
! extern "C" void exit(int);
! #endif
  
!                               #include <iostream.h>
                                int main() {
                                    cout << "";
                                    return 0;
--- 1229,1239 ----
  #line 1230 "configure"
  #include "confdefs.h"
! //#ifdef __cplusplus
! //extern "C" void exit(int);
! //#endif
  
!                               #include <iostream>
                                int main() {
+                                   using namespace std;
                                    cout << "";
                                    return 0;
diff -r -C2 netcdf-3.5.0.dist/src/cxx/nctst.cpp netcdf-3.5.0/src/cxx/nctst.cpp
*** netcdf-3.5.0.dist/src/cxx/nctst.cpp 1999-09-17 17:21:23.000000000 +0000
--- netcdf-3.5.0/src/cxx/nctst.cpp      2003-03-07 15:33:17.000000000 +0000
***************
*** 1,6 ****
! #include <iostream.h>
  #include <string.h>
  #include "netcdfcpp.h"
  
  void gen(const char* path)            // Generate a netCDF file
  {
--- 1,8 ----
! #include <iostream>
  #include <string.h>
  #include "netcdfcpp.h"
  
+ using namespace std;
+ 
  void gen(const char* path)            // Generate a netCDF file
  {
diff -r -C2 netcdf-3.5.0.dist/src/cxx/ncvalues.cpp 
netcdf-3.5.0/src/cxx/ncvalues.cpp
*** netcdf-3.5.0.dist/src/cxx/ncvalues.cpp      1998-12-22 18:21:49.000000000 
+0000
--- netcdf-3.5.0/src/cxx/ncvalues.cpp   2003-03-07 15:43:58.000000000 +0000
***************
*** 8,14 ****
   *********************************************************************/
  
! #include <iostream.h>         // for debugging
  #include "ncvalues.h"
  
  NcValues::NcValues( void ) : the_number(0), the_type(ncNoType)
  {}
--- 8,16 ----
   *********************************************************************/
  
! #include <iostream>           // for debugging
  #include "ncvalues.h"
  
+ using namespace std;
+ 
  NcValues::NcValues( void ) : the_number(0), the_type(ncNoType)
  {}
***************
*** 311,315 ****
      if (the_number > 0)
        os << the_values[the_number-1] ;
!     os.flags(save);
      return os;
  }
--- 313,317 ----
      if (the_number > 0)
        os << the_values[the_number-1] ;
!     os.flags((std::_Ios_Fmtflags) save);
      return os;
  }
***************
*** 323,327 ****
      if (the_number > 0)
        os << the_values[the_number-1];
!     os.flags(save);
      return os;
  }
--- 325,329 ----
      if (the_number > 0)
        os << the_values[the_number-1];
!     os.flags((std::_Ios_Fmtflags) save);
      return os;
  }
diff -r -C2 netcdf-3.5.0.dist/src/cxx/ncvalues.h netcdf-3.5.0/src/cxx/ncvalues.h
*** netcdf-3.5.0.dist/src/cxx/ncvalues.h        1998-10-28 17:10:16.000000000 
+0000
--- netcdf-3.5.0/src/cxx/ncvalues.h     2003-03-07 15:57:29.000000000 +0000
***************
*** 11,19 ****
  #define Ncvalues_def
  
! #include <iostream.h>
  #ifdef STRSTREAM_H_SPEC
  #   include STRSTREAM_H_SPEC
  #else
! #   include <strstream.h>
  #endif
  #include <limits.h>
--- 11,19 ----
  #define Ncvalues_def
  
! #include <iostream>
  #ifdef STRSTREAM_H_SPEC
  #   include STRSTREAM_H_SPEC
  #else
! #include <sstream>
  #endif
  #include <limits.h>
***************
*** 21,24 ****
--- 21,25 ----
  #include "netcdf.h"
  
+ using namespace std;
  typedef unsigned char ncbyte;
  
***************
*** 221,225 ****
  {                                                                           \
      char* s = new char[32];                                                 \
!     ostrstream ostr(s, sizeof(s));                                            
\
      ostr << the_values[n] << ends;                                          \
      return s;                                                               \
--- 222,226 ----
  {                                                                           \
      char* s = new char[32];                                                 \
!     ostringstream ostr(s, (std::_Ios_Openmode) sizeof(s));                    
\
      ostr << the_values[n] << ends;                                          \
      return s;                                                               \
diff -r -C2 netcdf-3.5.0.dist/src/cxx/netcdfcpp.h 
netcdf-3.5.0/src/cxx/netcdfcpp.h
*** netcdf-3.5.0.dist/src/cxx/netcdfcpp.h       2001-02-05 20:29:12.000000000 
+0000
--- netcdf-3.5.0/src/cxx/netcdfcpp.h    2003-03-07 15:33:48.000000000 +0000
***************
*** 155,159 ****
      
      // to construct dimensions, since constructor is private
!     friend NcFile;
  };
  
--- 155,159 ----
      
      // to construct dimensions, since constructor is private
!     friend class NcFile;
  };
  
***************
*** 358,362 ****
  
      // to make variables, since constructor is private
!   friend NcFile;
  };
  
--- 358,362 ----
  
      // to make variables, since constructor is private
!   friend class NcFile;
  };
  
***************
*** 389,393 ****
      
      // To make attributes, since constructor is private
!   friend NcFile;
    friend NcAtt* NcVar::get_att( NcToken ) const;
  };
--- 389,393 ----
      
      // To make attributes, since constructor is private
!   friend class NcFile;
    friend NcAtt* NcVar::get_att( NcToken ) const;
  };
  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: