Unresolved external symbol __imp_StrStrIA

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.

Might be related to Github issue: The cmake configuration should provide transitive dependencies (like shlwapi on MSVC) #3663

Does this mean there is a bug in HDF5 code distribution? Is there a workaround?

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:

  1. Run build-VS2019-64.bat to create the 64bit Release static libraries. I use cmake 3.25.1.
  2. 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.

same problem here:
Link: executing ‘C:\PROGRA~2\Intel\oneAPI\compiler\20231~1.0\windows\bin\Intel64....\bin-llvm\lld-link.exe’
lld-link: error: undefined symbol: __declspec(dllimport) StrStrIA

referenced by libhdf5.lib(H5system.obj):(Wstrcasestr_wrap)
Any update on this?

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.

1 Like