[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 19990702: AIX 4.2 / xlC bug (low)
- Subject: Re: 19990702: AIX 4.2 / xlC bug (low)
- Date: Tue, 06 Jul 1999 13:34:03 -0600
>To: "'address@hidden'" <address@hidden>
>From: Jean-Baptiste Robertson <address@hidden>
>Subject: AIX 4.2 / xlC bug (low)
>Organization: .
>Keywords: 199907021613.KAA19235
In the above message, you wrote:
> I just began to use netcdf-3.4 on AIX-4.2 with the xlC-3.1 C++
> compiler. netcdf was installed with no problem on my system, but
> when compiling my foo.cxx :
>
> > xlC -I/usr/local/netcdf-3.4/include -c foo.C
>
> I obtain :
>
> "/usr/local/netcdf-3.4/include/ncvalues.hh", line 51.9: 1540-030:
> (S) The macro "name2" has already been defined.
>
> "/usr/local/netcdf-3.4/include/ncvalues.hh", line 51.9: 1540-378:
> (I) "name2" is defined on line 29 of
> "/usr/lpp/xlC/include/generic.h".
>
> and the same for the macros "declare" and "implement"
>
> -> it does no work.
So either your "foo.cxx" file must #include <generic.h> or it must
#include something else that #includes generic.h. Wherever it is, you
could probably just delete the "#include <generic.h>" line, since all
modern C++ compilers no longer need generic.h.
The "generic.h" file used to be included with all C++ development
environments; it defined macros that were used to "glue" tokens
together to emulate the capabilities of templates. These macros had
names such as "name2", "declare", and "implement". Since the netCDF
C++ code was written before templates were widely available, it made
use of these macros. With netCDF version 3.4, the "#include
<generic.h>" was removed and the necessary macro definitions were just
included, so it would work whether templates were supported or not.
> I inserted "#ifndef GENERICH " in ncvalues.hh so that the macros are
> not defined again if generic.h is already there.
That solution will also work; it would be better if the macros in the
ncvalues.hh file used less common names that didn't clash with the old
generic.h names, or included something like your "#ifndef GENERICH"
solution. Unfortunately, there was no standard macro defined in
generic.h (for example, if you used the g++ compiler and libg++, it
would have to be "#ifndef generic_h").
--Russ
_____________________________________________________________________
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu