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

[no subject]



> From: NCAR/UCAR Consultant <address@hidden>
> Apparently-To: <address@hidden>
> Content-Type: text
> Content-Length: 6586

Hi,

> Making `all' in directory /t3ehome3/ncar/netcdf-3.4a/src/cxx
> 
>       CC -c -g  -I../libsrc -I.  -DNDEBUG netcdf.cc
> CC-403 CC: ERROR File = netcdf.hh, Line = 76
>   Member function function "NcFile::add_att" has already been declared.
> 
>       NcBool add_att( NcToken attname, ncbyte );
>              ^
> 
> CC-403 CC: ERROR File = netcdf.hh, Line = 84
>   Member function function "NcFile::add_att(NcToken, int, const unsigned char 
> *)"
>           has already been declared.
> 
>       NcBool add_att( NcToken attname, int, const ncbyte* );

 ...

> CC-302 CC: ERROR File = netcdf.cc, Line = 918
>   function "NcVar::add_att(NcToken, int, const unsigned char *)" has already
>           been defined.
> 
>   NcVar_add_vector_att(ncbyte)
>   ^
> 
> 34 errors detected in the compilation of "netcdf.cc".

This is apparently a longstanding problem due to a bug in the Cray C++
compiler that I reported in May 1996 (I would have thought it would have
been fixed by now).  In our INSTALL file, we recommend using the "-h
char" option as part of the value of the CXXFLAGS environment variable
to workaround this problem:

                        # We don't have the requisite compiler /usr/bin/CC.
    CXXFLAGS='-h char'  # If we did, this option would probably be 
                        # necessary due to a bug in the C++ compiler.

After setting the environment variable CXXFLAGS as above, you will need
to do the following from the top-level src/ directory (where the INSTALL
file resides) to get the C++ interface built:

  1. make clean
  2. rm config.cache
  3. ./configure [whatever args you supplied before]
  4. make all
  5. make test
  6. make install

In case, you're interested, I've appended details about the bug in the
Cray C++ compiler, including a small program that demonstrates it.

--Russ
_____________________________________________________________________

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


I've isolated the problem to a small program that demonstrates a failure
to distinguish plain char, signed char, and unsigned char as three
distinct types for overloading function signatures:

--------------------------------------
#include <iostream.h>

class X {
public:
    X() {}
    void f(char c)           {cout << "char "          << c << "\n";}
    void f(signed char s)    {cout << "signed char "   << s << "\n";}
    void f(unsigned char u)  {cout << "unsigned char " << u << "\n";}
};

int
main()
{
    X x;
    char c = 'c';
    signed char s = -13;
    unsigned char u = 'u';

    x.f(c);
    x.f(s);
    x.f(u);

    return 0;
}
--------------------------------------

The above program conforms to the C++ standard, as far as I have
been able to determine.

It compiles with no errors or warnings and runs fine on the following
many other platform/compiler combinations.