I am trying to build a 64bit Fortran HDF5 application using the 1.14.2 version of the API on Windows. I ran the build-VS2019-64.bat file. The only change I made was in HDF5options.cmake file to enable Fortran.
The API was compiled without any issue. But when I try to link my application against the static libraries I get the following error:
libhdf5.lib(H5system.obj) : error LNK2019: unresolved external symbol __imp_StrStrIA referenced in function Wstrcasestr_wrap
Also note that my application was previously linked to the 1.12.2 version of the HDF5 API successfully. How can I resolve this issue? Any help would be greatly appreciated.
I am having trouble reproducing this issue in current develop branch. Using a binary with the included examples and requesting to use static libraries, I do not see this error.
I also tried 1.14 develop branch and did not see this error.
I guess I need more info (not sure what) to reproduce this.
I uploaded a zip file to Box that hopefully will reproduce the issue. The file is a bit large; I didnāt want to exclude anything from the HDF5 build folder.
My workflow was:
Run build-VS2019-64.bat to create the 64bit Release static libraries. I use cmake 3.25.1.
Open Fortran_LinkerError.sln file in VS 2019 and compile. I use latest version of Intel Fortran (oneAPI 2023.2.1.7)
Hopefully, this is enough info to reproduce the issue.
The hdf5 library needs this on windows, 1.14.2 may be missing this requirement in the generated CMakeConfig files, which the newer versions should now include.
So we did add the lib requirement for shlwapi, however it looks like CMake or our use of CMake only added the requirement to the static library.
See the installed cmake folder and the hdf5-targets.cmake and check the INTERFACE_LINK_LIBRARIES lines for the hdf5 library.
Try adding the shlwapi part to the shared library line and see if that solves your problem.
We will investigate why, but it would help to know if it fixes your problem.
Every library target should have that property.
set_target_properties(hdf5::hdf5-shared PROPERTIES
should be the one to add the property,
set_target_properties(hdf5::hdf5-static PROPERTIES
should have the property.