[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20020508: netcdf 3.5.0: Intel C++ problem (fwd)



>To: address@hidden
>From: Ole Holm Nielsen <address@hidden>
>Subject: netcdf 3.5.0: Intel C++ problem
>Organization: Department of Physics, Technical University of Denmark
>Keywords: 200205081349.g48Dnsa10787 netCDF 3.5 Intel Fortran

Hi Ole,

> I'm trying to make our software work on the Pentium-4 platform
> using the Intel Fortran compiler (ifc) version 6.0.  If I use also
> the Intel C++ compiler (icc) version 6.0 the compilation aborts
> like this:
> 
> Making `all' in directory /scratch/ohnielse/NetCDF/netcdf-3.5.0/src/cxx
> 
> make[2]: Entering directory `/scratch/ohnielse/NetCDF/netcdf-3.5.0/src/cxx'
> icc -c  -I../libsrc -I.  -DNDEBUG netcdf.cpp
> netcdf.cpp
> ncvalues.h(40): warning #68: integer conversion resulted in a change of sign
>   static const ncbyte ncBad_byte = NC_FILL_BYTE;
>                                    ^
> 
> icc -c  -I../libsrc -I.  -DNDEBUG ncvalues.cpp
> ncvalues.cpp
> ncvalues.h(40): warning #68: integer conversion resulted in a change of sign
>   static const ncbyte ncBad_byte = NC_FILL_BYTE;
>                                    ^
> 
> ncvalues.cpp(313): error: no instance of overloaded function 
> "std::basic_ostream
> <_Elem, _Traits>::flags [with _Elem=char, _Traits=std::char_traits<char>]" 
> match
> es the argument list
>             argument types are: (long)
>       os.flags(save);
>          ^
> 
> ncvalues.cpp(325): error: no instance of overloaded function 
> "std::basic_ostream
> <_Elem, _Traits>::flags [with _Elem=char, _Traits=std::char_traits<char>]" 
> match
> es the argument list
>             argument types are: (long)
>       os.flags(save);
>          ^
> 
> compilation aborted for ncvalues.cpp (code 2)
> make[2]: *** [ncvalues.o] Error 2
> make[2]: Leaving directory `/scratch/ohnielse/NetCDF/netcdf-3.5.0/src/cxx'
> make[1]: *** [subdir_target] Error 1
> make[1]: Leaving directory `/scratch/ohnielse/NetCDF/netcdf-3.5.0/src'
> make: *** [cxx/all] Error 2

For C++, I think you'll have more luck using the netcdf-3.5.1-beta3
release available from

  ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.5.1-beta3.tar.Z

The problem is a transition in C++ standards that our netCDF C++
interface hasn't caught up to yet.  Some of the changes between
version 3.5.0 and version 3.5.1beta3 have been to address new
standard-conforming C++ compilers, but there may still be some
problems.  I've appended additional patches to the src/cxx/ files in
netcdf-3.5.1beta3 that haven't yet been incorporated into a release
but that will be in the next release, assuming these work on the
compilers we have access to.  Unfortunately I can't test them on the
Intel compiler because we don't have access to it yet.  If you get a
chance, I'd be interested in knowing whether these work for you.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu


diff -r -c /buddy/russ/netcdf-3.5.1-beta3/src/cxx/ncvalues.cpp ./ncvalues.cpp
*** /buddy/russ/netcdf-3.5.1-beta3/src/cxx/ncvalues.cpp Mon Jan 21 14:10:46 2002
--- ./ncvalues.cpp      Wed Feb 20 16:58:29 2002
***************
*** 4,14 ****
   *
   *   Purpose: implementation of classes of typed arrays for netCDF
   *
!  *   $Header: /upc/share/CVS/netcdf-3/cxx/ncvalues.cpp,v 1.4 2001/08/28 
15:25:59 russ Exp $
   *********************************************************************/
  
  #include <iostream>
! using namespace std;
  #include "ncvalues.h"
  
  NcValues::NcValues( void ) : the_number(0), the_type(ncNoType)
--- 4,14 ----
   *
   *   Purpose: implementation of classes of typed arrays for netCDF
   *
!  *   $Header: /upc/share/CVS/netcdf-3/cxx/ncvalues.cpp,v 1.6 2002/02/20 
23:58:29 russ Exp $
   *********************************************************************/
  
  #include <iostream>
! 
  #include "ncvalues.h"
  
  NcValues::NcValues( void ) : the_number(0), the_type(ncNoType)
***************
*** 26,32 ****
      return the_number;
  }    
  
! ostream& operator<< (ostream& os, const NcValues& vals)
  {
      return vals.print(os);
  }
--- 26,32 ----
      return the_number;
  }    
  
! std::ostream& operator<< (std::ostream& os, const NcValues& vals)
  {
      return vals.print(os);
  }
***************
*** 245,251 ****
      return s;
  }
  
! ostream& NcValues_short::print(ostream& os) const
  {
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
--- 245,251 ----
      return s;
  }
  
! std::ostream& NcValues_short::print(std::ostream& os) const
  {
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
***************
*** 254,260 ****
      return os;
  }
  
! ostream& NcValues_int::print(ostream& os) const
  {
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
--- 254,260 ----
      return os;
  }
  
! std::ostream& NcValues_int::print(std::ostream& os) const
  {
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
***************
*** 263,269 ****
      return os;
  }
  
! ostream& NcValues_nclong::print(ostream& os) const
  {
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
--- 263,269 ----
      return os;
  }
  
! std::ostream& NcValues_nclong::print(std::ostream& os) const
  {
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
***************
*** 272,278 ****
      return os;
  }
  
! ostream& NcValues_long::print(ostream& os) const
  {
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
--- 272,278 ----
      return os;
  }
  
! std::ostream& NcValues_long::print(std::ostream& os) const
  {
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
***************
*** 281,287 ****
      return os;
  }
  
! ostream& NcValues_ncbyte::print(ostream& os) const
  {
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
--- 281,287 ----
      return os;
  }
  
! std::ostream& NcValues_ncbyte::print(std::ostream& os) const
  {
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
***************
*** 290,296 ****
      return os;
  }
  
! ostream& NcValues_char::print(ostream& os) const
  {
      os << '"';
      long len = the_number;
--- 290,296 ----
      return os;
  }
  
! std::ostream& NcValues_char::print(std::ostream& os) const
  {
      os << '"';
      long len = the_number;
***************
*** 303,311 ****
      return os;
  }
  
! ostream& NcValues_float::print(ostream& os) const
  {
!     streamsize save=os.precision();
      os.precision(7);
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
--- 303,311 ----
      return os;
  }
  
! std::ostream& NcValues_float::print(std::ostream& os) const
  {
!     std::streamsize save=os.precision();
      os.precision(7);
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
***************
*** 315,323 ****
      return os;
  }
  
! ostream& NcValues_double::print(ostream& os) const
  {
!     streamsize save=os.precision();
      os.precision(15);
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
--- 315,323 ----
      return os;
  }
  
! std::ostream& NcValues_double::print(std::ostream& os) const
  {
!     std::streamsize save=os.precision();
      os.precision(15);
      for(int i = 0; i < the_number - 1; i++)
        os << the_values[i] << ", ";
diff -r -c /buddy/russ/netcdf-3.5.1-beta3/src/cxx/ncvalues.h ./ncvalues.h
*** /buddy/russ/netcdf-3.5.1-beta3/src/cxx/ncvalues.h   Mon Jan 21 14:37:09 2002
--- ./ncvalues.h        Wed Feb 20 16:58:29 2002
***************
*** 4,21 ****
   *
   *   Purpose: interface for classes of typed arrays for netCDF
   *
!  *   $Header: /upc/share/CVS/netcdf-3/cxx/ncvalues.h,v 1.1 1998/10/28 
17:10:16 russ Exp $
   *********************************************************************/
  
  #ifndef Ncvalues_def
  #define Ncvalues_def
  
  #include <iostream>
! using namespace std;
! #include <strstream>
! 
! #include <limits.h>
! #include <string.h>
  #include "netcdf.h"
  
  typedef unsigned char ncbyte;
--- 4,17 ----
   *
   *   Purpose: interface for classes of typed arrays for netCDF
   *
!  *   $Header: /upc/share/CVS/netcdf-3/cxx/ncvalues.h,v 1.3 2002/02/20 
23:58:29 russ Exp $
   *********************************************************************/
  
  #ifndef Ncvalues_def
  #define Ncvalues_def
  
  #include <iostream>
! #include <sstream>
  #include "netcdf.h"
  
  typedef unsigned char ncbyte;
***************
*** 80,86 ****
      virtual int invalid( void ) const;                                        
      \
    private:                                                                  \
      TYPE* the_values;                                                       \
!     ostream& print(ostream&) const;                                         \
  };
  
  #define NcTypeEnum(TYPE) makename2(_nc__,TYPE)
--- 76,82 ----
      virtual int invalid( void ) const;                                        
      \
    private:                                                                  \
      TYPE* the_values;                                                       \
!     std::ostream& print(std::ostream&) const;                                 
      \
  };
  
  #define NcTypeEnum(TYPE) makename2(_nc__,TYPE)
***************
*** 217,225 ****
  #define as_string_implement(TYPE)                                           \
  char* NcVal(TYPE)::as_string( long n ) const                                \
  {                                                                           \
!     char* s = new char[32];                                                 \
!     ostrstream ostr(s, sizeof(s));                                            
\
!     ostr << the_values[n] << ends;                                          \
      return s;                                                               \
  }
  
--- 213,223 ----
  #define as_string_implement(TYPE)                                           \
  char* NcVal(TYPE)::as_string( long n ) const                                \
  {                                                                           \
!     char* s = new char[32];                                                   
\
!     std::ostringstream ostr;                                                  
\
!     ostr << the_values[n];                                            \
!     ostr.str().copy(s, std::string::npos);                                    
           \
!     s[ostr.str().length()] = 0;                                               
      \
      return s;                                                               \
  }
  
***************
*** 230,236 ****
      NcValues(NcType, long);
      virtual ~NcValues( void );
      virtual long num( void );
!     virtual ostream& print(ostream&) const = 0;
      virtual void* base( void ) const = 0;
      virtual int bytes_for_one( void ) const = 0;
  
--- 228,234 ----
      NcValues(NcType, long);
      virtual ~NcValues( void );
      virtual long num( void );
!     virtual std::ostream& print(std::ostream&) const = 0;
      virtual void* base( void ) const = 0;
      virtual int bytes_for_one( void ) const = 0;
  
***************
*** 250,256 ****
    protected:
      NcType the_type;
      long the_number;
!     friend ostream& operator<< (ostream&, const NcValues&);
  };
  
  declare(NcValues,ncbyte)
--- 248,254 ----
    protected:
      NcType the_type;
      long the_number;
!     friend std::ostream& operator<< (std::ostream&, const NcValues&);
  };
  
  declare(NcValues,ncbyte)