linker problem on cygwin

Hello,

I'm using Cygwin with HDF 1.8.9. I have build the HDF libs with configure, make and all libs are *.a / *.la files.
If I build an executable creates the linker an error:

library/build_release/hdf/1.8.9/lib/libhdf5_cpp.a(H5File.o):H5File.cpp:(.text+0x2026): undefined reference to `_H5Rget_obj_type1'
library/build_release/hdf/1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.cpp:(.text+0x576): undefined reference to `_H5Dcreate2'
library/build_release/hdf/1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.cpp:(.text+0x6fd): undefined reference to `_H5Dopen2'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: library/build_release/hdf/1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o): bad reloc address 0x4 in section `.rdata$_ZTVN2H58CommonFGE[vtable for H5::CommonFG]'

The linker command is:
g++ -o build/release/executable.exe -fopenmp --as-needed examples/executable.o -Llibrary/build_release/hdf/1.8.9/lib -lhdf5 -lhdf5_hl -lhdf5_cpp -lhdf5_hl_cpp

I'm using C & CPP interface of the HDF library.
Same code and library under Linux works without any problem
Can anybody help me to solve this linker problem? Thanks

Phil

Hi Kraus,
first, the the C interface of HDF5 is already available as
cygwin package

$ cygcheck -c -d|grep hdf5
hdf5 1.8.9-1
libhdf5-devel 1.8.9-1
libhdf5_7 1.8.9-1

About your problem, on cygwin and on windows in general
the order of linking is important

try
    -lhdf5_hl_cpp -lhdf5_cpp -lhdf5_hl -lhdf5

Regards
Marco

···

On 10/21/2012 12:22 AM, Kraus Philipp wrote:

Hello,

I'm using Cygwin with HDF 1.8.9. I have build the HDF libs with configure, make and all libs are *.a / *.la files.
If I build an executable creates the linker an error:

library/build_release/hdf/1.8.9/lib/libhdf5_cpp.a(H5File.o):H5File.cpp:(.text+0x2026): undefined reference to `_H5Rget_obj_type1'
library/build_release/hdf/1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.cpp:(.text+0x576): undefined reference to `_H5Dcreate2'
library/build_release/hdf/1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o):H5CommonFG.cpp:(.text+0x6fd): undefined reference to `_H5Dopen2'
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: library/build_release/hdf/1.8.9/lib/libhdf5_cpp.a(H5CommonFG.o): bad reloc address 0x4 in section `.rdata$_ZTVN2H58CommonFGE[vtable for H5::CommonFG]'

The linker command is:
g++ -o build/release/executable.exe -fopenmp --as-needed examples/executable.o -Llibrary/build_release/hdf/1.8.9/lib -lhdf5 -lhdf5_hl -lhdf5_cpp -lhdf5_hl_cpp

I'm using C & CPP interface of the HDF library.
Same code and library under Linux works without any problem
Can anybody help me to solve this linker problem? Thanks

Phil