Hello ladies and gentlemen!
I'm trying to compile a minimal HDF5 example via MinGW on w32:
#include "hdf5.h"
int main()
{
hid_t file_id;
hid_t dataset_id;
hid_t attribute_id;
hid_t space_id;
hssize_t nscans, npeaks;
double minmz, maxmz;
printf("Opening MS.abf ... ");
file_id = H5Fopen("MS.abf", H5F_ACC_RDONLY, H5P_DEFAULT);
if(file_id > 0)
printf("done.\n");
else{
printf("error!\n");
return 1;
};
dataset_id = H5Dopen(file_id, "rettime", H5P_DEFAULT);
space_id = H5Dget_space(dataset_id);
nscans = H5Sget_simple_extent_npoints(space_id);
printf("Total scans: %lld.\n", nscans);
H5Sclose(space_id);
H5Dclose(dataset_id);
dataset_id = H5Dopen(file_id, "specdata/mz", H5P_DEFAULT);
space_id = H5Dget_space(dataset_id);
npeaks = H5Sget_simple_extent_npoints(space_id);
printf("Total MS peaks: %lld.\n", npeaks);
H5Sclose(space_id);
attribute_id = H5Aopen(dataset_id, "min", H5P_DEFAULT);
H5Aread(attribute_id, H5T_NATIVE_DOUBLE, &minmz);
H5Sclose(attribute_id);
attribute_id = H5Aopen(dataset_id, "max", H5P_DEFAULT);
H5Aread(attribute_id, H5T_NATIVE_DOUBLE, &maxmz);
H5Sclose(attribute_id);
printf("M/z range: %f..%f.\n", minmz, maxmz);
H5Dclose(dataset_id);
H5Fclose(file_id);
return;
}
I'm running
>gcc test.c -I"C:\Progra~2\HDF_Group\HDF5\1.8.12\include" -L"C:\Progra~2\HDF_Group\HDF5\1.8.12\lib" -lhdf5 -otest.exe
but I get
C:\Users\paramon\AppData\Local\Temp\ccqrZOee.o:test.c:(.text+0x177): undefined reference to `H5T_NATIVE_DOUBLE_g'
C:\Users\paramon\AppData\Local\Temp\ccqrZOee.o:test.c:(.text+0x1c5): undefined reference to `H5T_NATIVE_DOUBLE_g'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Users\paramon\AppData\Local\Temp\ccqrZOee.o: bad reloc address 0x20 in section `.eh_frame'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
It seems to be some problem with H5T_NATIVE_DOUBLE or, more generally, with DLLVARs. Without them, the program compiles and runs fine.
Does anyone has experience with building HDF5-dependant code on w32? I wish to write a small demo example for my HDF5-based format; I do not have much C experience, so maybe I'm missing something really simple.
Best wishes,
Andrey Paramonov
···
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.