PDA

View Full Version : Using HDF5 libraries on QT



breotone
16th January 2012, 22:21
Hi,

I need to use the format HDF5 for some data we collected (.h5 files). I was trying to install the libraries, but I am having a lot of problems with it. I was searching for it, but I couldn't find any useful information.

I will appreciate your help!

Thanks

wysota
16th January 2012, 22:30
Provide more info on those errors you get.

breotone
17th January 2012, 16:32
For the first step, I installed the libraries directly from the ubuntu repositories:

libhdf5-serial-1.6.6-0 (not this version, the new one)
libhdf5-serial-dev
libhdf5-doc
hdf5-tools

Then, I try with a simple code on QT, this is:

#include <iostream>
using namespace std;

#include <H5Cpp.h>
using namespace H5;

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;

H5File fout("data.h5",H5F_ACC_TRUNC);

w.show();

return a.exec();
}

And I get the following compilation errors:
7282

I think it is a problem of linking the libraries, but I was searching online and I couldn't find a solution yet...

Thanks for your help!

wysota
17th January 2012, 21:24
How does your .pro file look like?

ChrisW67
17th January 2012, 21:35
See Declaring Other Libraries

breotone
17th January 2012, 22:38
I switched the line in the .pro file

LIBS += /usr/lib/libhdf5_cpp.so

for the suggested

LIBS += /usr/lib/libhdf5_cpp.so -lhdf5

And at least with the first examples, it is working!

Thank you very much for you reply and help!! (I will keep on working on this, so if I finally can make it, I will write a small guide for setting up this library)

ChrisW67
17th January 2012, 22:40
You should not need the /usr/lib/libhdf5_cpp.so part of that line.