[gdal-dev] Definition conflict in HDF4 driver?

Kolberg Sjur A Sjur.A.Kolberg at sintef.no
Tue Oct 28 08:26:45 EDT 2008


Hello, list...

I am trying to compile GDAL 1.5.3 with HDF and GRIB drivers, under MSVC 2005-SP1, using the project files distributed at http://vterrain.org/Distrib/gdal.html <http://vterrain.org/Distrib/gdal.html> . I have installed pre-built binaries for HDF42r3 and HDF5-1.8.1. and the libraries they depend on. 
 
I seem to get a conflict between the GDAL file hdf4dataset.h and the HDF4 file mfhdfi.h concerning 'UNKNOWN' as an enum definition:
1>c:\program files\gdal-1.5.3\frmts\hdf4\hdf4dataset.h(55) : error C2365: 'UNKNOWN' : redefinition; previous definition was 'enumerator'
1> c:\program files\hdf42r3\include\mfhdfi.h(26) : see declaration of 'UNKNOWN'
 
The revelant code appears as 
 
in mfhdfi.h: (#included in mfhdf.h, which is #included in hdf4dataset.cpp and hdf4imagedataset.cpp).
typedef enum
{
IS_SDSVAR=0, /* variable is an actual SDS */
IS_CRDVAR=1, /* variable is a coordinate variable */
UNKNOWN=2  /* variable is created before HDF4.2r2, unknown type */
} hdf_vartype_t;
 
and in hdf4dataset.h:
typedef enum // Types of data products:
{
GDAL_HDF4, // HDF written by GDAL
EOS_GRID, // HDF-EOS Grid
EOS_SWATH, // HDF-EOS Swath
EOS_SWATH_GEOL, // HDF-EOS Swath Geolocation Array
SEAWIFS_L1A, // SeaWiFS Level-1A Data
SEAWIFS_L2, // SeaWiFS Level-2 Data
SEAWIFS_L3, // SeaWiFS Level-3 Standard Mapped Image
HYPERION_L1, // Hyperion L1 Data Product
UNKNOWN
} HDF4SubdatasetType;
 
 
A couple of additional errors seems to follow from this conflict:
1>..\..\frmts\hdf4\hdf4imagedataset.cpp(2294) : error C2440: '=' : cannot convert from 'hdf_vartype_t' to 'HDF4SubdatasetType'
1> Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
1>..\..\frmts\hdf4\hdf4dataset.cpp(744) : error C2440: '=' : cannot convert from 'hdf_vartype_t' to 'HDF4SubdatasetType'
1> Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
 
 
Is this because I downloaded the latest pre-built HDF4 (4.2r3)  and thus ignored the http://trac.osgeo.org/gdal/wiki/HDF <http://trac.osgeo.org/gdal/wiki/HDF>  stating "HDF 4.2r1 is generally the preferred version if working from source"?
 
 
 

Also, in hdf4imagedataset.cpp lines 854 to 859 go:

if ( (SDsetattr( hSD, pszName, DFNT_CHAR8,
strlen(pszValue) + 1, pszValue )) < 0 );
{
CPLDebug( "HDF4Image",
"Cannot write metadata information to output file");
}
 
in which the semicolon ending the IF statement prevents the CPLDebug from ever being executed. Is this intentional?
 
 
Regards, Sjur K :-)
 

Sjur Kolberg
SINTEF Energiforskning A/S
Sem Sælands vei 11
7465 Trondheim
tlf. 73 59 72 78
fax  73 59 72 50 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20081028/3be77d92/attachment.html


More information about the gdal-dev mailing list