Hi
TL;DR
I am attempting to run the Basics of HDF5 in C++ using VS2019 using MSBuild, not cmake.
I keep recieving linker errors.
Is it even possible to use the MSBuild system with HDF5? Or should I be using cmake?
Full Error
I am attempting to run the Basics of HDF5 in C++ using VS2019 using MSBuild, not cmake.
However I always recieved the following error when attempting to compile the first example:
1>Demo1.obj : error LNK2001: unresolved external symbol “public: static class H5::LinkCreatPropList const & const H5::LinkCreatPropList::DEFAULT” (?DEFAULT@LinkCreatPropList@H5@@2AEBV12@EB)
1>Demo1.obj : error LNK2001: unresolved external symbol “public: static class H5::FileAccPropList const & const H5::FileAccPropList::DEFAULT” (?DEFAULT@FileAccPropList@H5@@2AEBV12@EB)
1>Demo1.obj : error LNK2001: unresolved external symbol “public: static class H5::DSetAccPropList const & const H5::DSetAccPropList::DEFAULT” (?DEFAULT@DSetAccPropList@H5@@2AEBV12@EB)
1>Demo1.obj : error LNK2001: unresolved external symbol “public: static class H5::DSetCreatPropList const & const H5::DSetCreatPropList::DEFAULT” (?DEFAULT@DSetCreatPropList@H5@@2AEBV12@EB)
1>Demo1.obj : error LNK2001: unresolved external symbol “public: static class H5::PredType const & const H5::PredType::STD_I32BE” (?STD_I32BE@PredType@H5@@2AEBV12@EB)
1>Demo1.obj : error LNK2001: unresolved external symbol “public: static class H5::FileCreatPropList const & const H5::FileCreatPropList::DEFAULT” (?DEFAULT@FileCreatPropList@H5@@2AEBV12@EB)
1>C:\Users\admin\repos\hdf5Demos\bin\x64\Release\hdf5Demos.exe : fatal error LNK1120: 6 unresolved externals
-
I have installed the pre compiled binaries multiple times for hdf5 versions 1.12.0 and 1.10.7.
-
I have tried debug and release and am definitely using x64 at every stage
-
I have followed the “USING_HDF5_VS.txt” and added the include and lib dirs and appropriate libs
-
I have also tried compiling the source using cmake on my machine - which generates the libs fine. But still yields the same error when trying the Basic tutorials.
I have notcied that two of the libs mentioned in USING_HDF5_VS.txt are missing from the precompiled binaries “hdf5-1.10.7-Std-win10_64-vs16.zip” (Windows 10 64-bit pre-built binary for CMake VS 2019 C, C++, IVF).
- szip.lib
- zlib.lib
Although it is mentioned here that AEC replaced szip in 1.10.7 and when using the precompiled binaries for 1.12.0 these two libraries are both included. Eitherway I do not believe they are needed for these first examples.
The release notes mention a compiler flag which must be set if one intends to use the shared libs. This is in the release_docs. However when building from source using the the cmake GUI and CMake-hdf5-1.12.0 the following flag is not listed:
H5_BUILT_AS_DYNAMIC_LIB
However I intend to use the static libs so this again should not be a problem…