I am trying to compile code (for saving 3D image data) using HDF5 on Windows 10 with Visual Studio 17.2 (x64).
I downloaded and installed the binary of HDF5 v1.14.3 (x64).
I added the include path and lib path into the corresponding Visual Studio options and specify those 2 lib: hdf5_cpp.lib hdf5.lib.
I also added the bin path to the “PATH” env variable.
However, I still have an unresolved external symbol for: H5T_NATIVE_INT_g. I have tried various other type_id’s when creating a dataset, but always get an unresolved external symbol.
Is there something I’m missing for properly using HDF5 in visual studio/c++?
When using the shared library, be sure to add the define => H5_BUILT_AS_DYNAMIC_LIB
see the “Using Visual Studio” section in the doxygen “Compiling HDF5 Applications” page.
We do have this in a file in the source "release_docs/USING_HDF5_VS.txt but we should include it in one of the text files of the binary.
To be extra clear for other users that see this post, the solution was to define H5_BUILT_AS_DYNAMIC_LIB. This is done by going to project Properties->Configuration Properties->C/C+±>Preprocessor and adding H5_BUILT_AS_DYNAMIC_LIB to Preprocessor definitions.
Firstly, correct HDF5 version v1.14.3, set accurate library paths, confirm proper library names such as hdf5_cpp.lib and hdf5.lib, check compiler options for x64 and C++ standard and add HDF5 bin directory to PATH and rebuild your project. Include H5Cpp.h in your code, utilizing the correct namespaces and classes for HDF5.