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

Re: 19980729: What is <generic.h> ?



>To: address@hidden
>From: Ionut Borcoman at home <address@hidden>
>Subject: What is <generic.h> ?
>Organization: .
>Keywords: 199807292004.OAA07627

Hi Ionutz,

> I have an debian hamm linux system and netcdf 3. I was able to compile
> the example.c but not the example.cc. I have two problems:
> 
> 1. The file generic.h is missing from my system. What is this file for ?

The 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.

In the latest version, netCDF 3.4 available from 

   ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.4.zip
or
   ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-3.4.tar.Z

the #include <generic.h> in cxx/ncvalues.hh has been replaced with a
definition of the necessary macros:

// macros to glue tokens together to form new names (used to be in generic.h)
#define name2(a,b) a ## b
#define declare(clas,t)        name2(clas,declare)(t)
#define implement(clas,t)      name2(clas,implement)(t)

> 2. Putting an empty /usr/include/generic.h file, the compiler reported
> (note that example.cc is renamed as main.cc):

 [lots of errors ...]

These errors should all go away if you insert the above definitions or
use the more recent netCDF 3.4 version.

> Can you please explain me what the problem could be as I would prefer to
> use the c++ instead of c.

The C++ interface is getting a bit dated, since it made no use of
templates, exceptions, or the stdc++ library.  We're currently
concentrating our efforts on the new Java implementation of netCDF ...

--Russ

_____________________________________________________________________

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