I am trying to compile and link a project that uses the HDF5 library. I am using Windows 10, VS2015 (C++ compiler) and CMake. I run into problems during the linking and get a lot of errors like
libhdf5_cpp.lib(H5Attribute.obj) : error LNK2001: unresolved external symbol _H5open
I am compiling a 32-bit application and I use the 32-bit pre-build binaries of the HDF5 package. The linker is trying to link with the libhdf5_cpp.lib file (which should be the static library according to the HDF5 home page). I have tried both Release and Debug mode during compiling. I have also tried to link dynamically, which resulted in the same error messages.
I have spent quite some time with this now and I am unsure that I will solve this in a reasonable time by myself. Does anyone have any good suggestions on hot to proceed?
And yeah, the CMake script and compiling works well under Linux so I guess it is VS related in some way.
For my problem, First I download pre-build HDF5 for Windows 64. Visual Studio 2015 I found there is two type of .lib files one begin with prefix "lib" and another one wihtout prefix "lib"

which I do not understand the different.
In the begining, I linkined to all .lib file for C++ ( do not use f90 fortran JAVA ... )
The compiler said there are duplicate symbol. Then I linked only hdf5.lib ... hdf5_cpp.lib ( without word "lib") in front . Then the compiler says "Undefied external symbol" command on QT pro are
INCLUDEPATH += "C:/Program Files/HDF_Group/HDF5/1.10.2/include"
LIBS += -L"C:/Program Files/HDF_Group/HDF5/1.10.2/lib"
LIBS += -lhdf5
LIBS += -lhdf5_cpp
LIBS += -lhdf5_hl
LIBS += -lhdf5_hl_cpp
LIBS += -lhdf5_tools
LIBS += -lszip
LIBS += -lzlib
... which produced the same problem that you have. "COMPILE ERROR"
after that I link to libhdf5.lib , libhdf5_cpp.lib... command on QT pro are
INCLUDEPATH += "C:/Program Files/HDF_Group/HDF5/1.10.2/include"
LIBS += -L"C:/Program Files/HDF_Group/HDF5/1.10.2/lib"
LIBS += -llibhdf5
LIBS += -llibhdf5_cpp
LIBS += -llibhdf5_hl
LIBS += -llibhdf5_hl_cpp
LIBS += -llibhdf5_tools
LIBS += -llibszip
LIBS += -llibzlib
and it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With