Hi,

On Wed, Jan 11, 2012 at 04:29:22PM -0700, Gordon Smith wrote:
> I am unable to compile on Ubuntu using the supplied HDF5 library. The
> headers seem to insist on using version 1.6.
> 
> For example, the file:
> 
> {{{
> #if defined( H5_USE_16_API )
>     @@@@
> #endif
> #include <hdf5.h>
> #if defined( H5_USE_16_API )
>     @@@@
> #endif
> 
> void DatagroupOpenOrCreate( hid_t parentID, const char * const groupPath ) {
>     hid_t groupID = H5Gcreate( parentID, groupPath, H5P_DEFAULT,
> H5P_DEFAULT, H5P_DEFAULT );
> }
> }}}
> 
> Results in the following errors:
> 
> {{{
> g++ -Wall -fexceptions  -g   -c Datagroup.cpp -o Datagroup.o
> Datagroup.cpp:6: error: stray ‘@’ in program
> Datagroup.cpp:6: error: stray ‘@’ in program
> Datagroup.cpp:6: error: stray ‘@’ in program
> Datagroup.cpp:6: error: stray ‘@’ in program
> /usr/include/H5Gpublic.h: In function ‘hid_t DatagroupOpenOrCreate(hid_t,
> const char*)’:
> /usr/include/H5Gpublic.h:147: error: too many arguments to function ‘hid_t
> H5Gcreate1(hid_t, const char*, size_t)’
> Datagroup.cpp:10: error: at this point in file
> }}}
> 
> I need to call H5Gcreate2, not H5Gcreate1. The macro H5_USE_16_API is
> defined by including "hdf5.h", which is unexpected.

You can either explicitely call H5Gcreate2() or define a macro
before including the HDF5 header file that controls which ver-
sion of the interface is used. With the following macros I
think everything is covered:

--------8<-----------------------------------
#define H5Acreate_vers            2
#define H5Adelete_vers            2
#define H5Aiterate_vers           2
#define H5Arename_vers            2
#define H5Dcreate_vers            2
#define H5Dopen_vers              2
#define H5Eclear_vers             2
#define H5Eprint_vers             2
#define H5Epush_vers              2
#define H5Eset_auto_vers          2
#define H5Eget_auto_vers          2
#define H5Ewalk_vers              2
#define H5Gcreate_vers            2
#define H5Gopen_vers              2
#define H5Pget_filter_vers        2
#define H5Pget_filter_by_id_vers  2
#define H5Pinsert_vers            2
#define H5Pregister_vers          2
#define H5Rget_obj_type_vers      2
#define H5Tarray_create_vers      2
#define H5Tcommit_vers            2
#define H5Tget_array_dims_vers    2
#define H5Topen_vers              2

#define H5_NO_DEPRECATED_SYMBOLS

#include <H5Cpp.h>
--------8<-----------------------------------

> This is Ubuntu Linux libhdf5-serial-dev version 1.8.4-5.

I don't think there's anything special about Ubuntu, it's
that way everywere, see e.g.

http://www.hdfgroup.org/HDF5/doc/RM/APICompatMacros.html

                                Regards, Jens
-- 
  \   Jens Thoms Toerring  ________      [email protected]
   \_______________________________      http://toerring.de

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to