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

Re: 980211: Problem compiling netCDF Sources



>To: address@hidden
>cc: address@hidden (Bob McDonald)
>From: address@hidden
>Subject: Problem compiling netCDF Sources
>Organization: .
>Keywords: 199802111316.GAA02414

Hi Bob,

> I hope you have some suggestions about how to handle the following problem.
> 
> I am trying to compile netCDF232, using  MSoft Dev. Studio, version 4.0.  I
> can't seem to get beyond the following error which is repeated many times in
> each netCDF function.
> 
> "MSDEVSTD\INCLUDE\stdlib.h(421) : error C2371: 'malloc' : redefinition;
> different basis"
> 
> the stdlib.h line to which the diagnostic refers is:
> 
> _CRTIMP void * __cdecl malloc(size_t);
> 
> The following is a typical call to malloc from array.c:
> 
>       ret = (NC_array * malloc(sizeof(NC_array)) ;

That's probably a typo.  It should be

        ret = (NC_array *)malloc(sizeof(NC_array)) ;

I'm not sure what the MSoft Dev. Studio error message is complaining
about, but the old version 2.3.2 was before we rewrote netCDF in ANSI
Standard C, so I'm not surprised there are errors with this old
version.  Nevertheless, I'm forwarding this to Glenn Davis, in case he
understands the error message.   But I also think it would be better
to use a newer version of netCDF written in Standard C.

> There are many calls to malloc in array.c and other functions in the netCDF
> API.  It really isn't practical to correct all of them,or to change stdlib.h.
> In addition, there is a slew of warnings about conflicts between signed and
> unsigned variables (which hopefully can be ignored).
> 
> I have previously compiled  netCDF using MS C++.  but that doesn't work now
> because of some sort of conflict with Windows 95. (C++ can't find the include
> files )
> 
> My next try was to download netCDF 3.3 from the internet, hoping that
> it would compile under MS Dev Studio 4.0, but I can't decompress it.
> The file name extension is .Z.  Pkunzip and pkzipfix say it isn.t a
> zip file.
> 
> Can you help me?

The ".Z" extension means the file is compressed with the Unix "compress"
utility, a widely used implementation of Limpel-Ziv compression that
predates zip and other packed formats.  We still use it because more of
the target systems for netCDF seem to have "uncompress" than "pkunzip"
or "gunzip" or other varieties of unpacking utilities.  I can make a
".zip" version of the netCDF 3.3.1 sources available to you via FTP, if
you want to compile from the sources.

However, it might be better to take advantage of work that has already
been done to port netCDF 3.3.1 to Win32 platforms.  If you wish to build
from source on a Win32 platform, obtain
<ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/maks.zip>, unpack
it, and read WIN32_INSTALL. See
<ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/README> for more
information on this and other ports to Win32 platforms.

Also, a pre-compiled netCDF 3.3 for GNU Win32 (that includes a port of
udunits) is available from
<ftp://niteroi.gsfc.nasa.gov/pub/win32/unidata/netcdf>.  A README
describing this version is also available from
<ftp://niteroi.gsfc.nasa.gov/pub/win32/unidata/netcdf/README>.

--Russ

_____________________________________________________________________

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