2

Any help is much appreciated. I'm having link errors when trying to use HDF5 libraries installed using vcpkg with Visual Studio 2019 on Windows 10.

I installed HDF5 1.12.0 on Windows 10 using vcpkg: PowerShell: .\vcpkg install hdf5 hdf5:x64-windows

I then attempted to use Visual Studio 2019 to build my project that uses HDF5, but I keep getting the following LNK2001 errors.

  • unresolved external symbol H5T_IEEE_F64BE_g
  • unresolved external symbol H5T_STD_I64BE_g
  • unresolved external symbol H5T_C_S1_g
  • unresolved external symbol H5T_NATIVE_INT_g
  • unresolved external symbol H5T_NATIVE_DOUBLE_g

I tried to solve this by directly adding the additional library directories that are under the vcpkg/packages/ for HDF5, SZIP, and ZLIB, that were automatically installed as part of the HDF5 installation step given previously, and I also added the library files to the additional dependencies in the order prescribed by the HDF5 documentation:

  • hdf5_hl.lib
  • hdf5.lib
  • szip.lib
  • zlib.lib

But I still have the unresolved external symbol errors.

Normandin
  • 69
  • 2

2 Answers2

2

All those symbols are prefixed with H5_DLLVAR. As such you need to explicitly set the preprocessor definitionH5_BUILT_AS_DYNAMIC_LIBif you are not using CMake and only the MSBuild integration vcpkg provides. You could also open and issue with vcpkg since it should embedded that definition into the correct hdf5 header if the library is built dynamically.

Alexander Neumann
  • 1,479
  • 8
  • 17
-1

The vcpkg command that I used installs the dynamic version of the libraries. Instead I installed the static version of the libraries using:

./vcpkg install hdf5:x64-windows-static

No manual inclusion of the library directories or libraries themselves is needed. Just be sure to run this command as well (when first installing vcpkg):

./vcpkg.exe integrate install

Once that was done, Visual Studio 2019 was able to properly use the HDF5 libraries for my project and the linker error was gone (binary produced).

Hope this helps someone in the future!

Normandin
  • 69
  • 2