Using HDF5 in Qt Creator


#1

I downloaded hdf5-1.12.0-Std-win10_64-vs14.zip file and installed it on a Windows 10 computer. I installed it in “C:/HDF_Group/HDF5/1.12.0/”

I am using Qt Creator version 4.14.0.

I am writing a new Qt Creator application using the HDF5 library. I am using the kit ‘Desktop Qt 5.13.1 MSVC2017 64bit’

So far, I solved most of the unresolved external symbols associated with the HDF5 library. I still have 2 unresolved external symbols:
- H5::FileAccPropList()
- H5::FileCreatPropList()

The pro file is :

QT -= gui

CONFIG += c++11 console
CONFIG -= app_bundle

DEFINES += QT_DEPRECATED_WARNINGS

INCLUDEPATH += ‘C:/HDF_Group/HDF5/1.12.0/include’

HEADERS +=
…/pragmamfmc.h

SOURCES +=
MFMCTest.cpp

DEPENDPATH += ‘C:/HDF_Group/HDF5/1.12.0/include’

win32:contains(QMAKE_HOST.arch, x86_64) {
win32:CONFIG(release, debug|release): LIBS += -L’C:/HDF_Group/HDF5/1.12.0/lib’ -lhdf5_cpp -lhdf5 -lszip -lzlib
else:win32:CONFIG(debug, debug|release): LIBS += -L’C:/HDF_Group/HDF5/1.12.0/lib’ -lszip -lzlib -lhdf5 -lhdf5_cpp
}

The source file is:

#if defined(_WIN32) || defined(_WIN64)
#define _USE_MATH_DEFINES
#endif

#include “H5Cpp.h”

// Private function prototypes
static void testMFMC();

int main() {
testMFMC();
return EXIT_SUCCESS;
}

static void testMFMC() {
H5::H5File file(“fileName”, H5F_ACC_TRUNC);
file.close();
}

What should I change to resolved the 2 missing external symbols?

Thanks for your help!


#2

Full disclosure: I don’t know anything about Qt Creator. The missing symbols H5::FileAccPropList(), H5::FileCreatPropList() are presumably in hdf5_cpp.lib. Can you run something like dumpbin /symbols to confirm their presence? Is your linker a multi-pass linker? Why are the link orders -lhdf5_cpp -lhdf5 and -lhdf5 -lhdf5_cpp different between the configurations? (Wouldn’t matter for multi-pass, but just checking…) The calls are obviously coming out of the constructor H5::H5File file(“fileName”, H5F_ACC_TRUNC);

G.