HDF5-Fortran: Visual Studio 2019 + Intel Fortran + Win10 x64

I would like to use the HDF5 files in my Fortran-2008 projects, so I need to get the static and dynamic HDF5 libraries files to usem them.

==> What I already did:

  1. I downloaded and installed the HDF5 Windows 10 x64 VS15 binary installer from the HDF5 official web site (here)

  2. I tested it running this command inside the Windows console: h5dump.exe. It works good!

  3. So I copy one basic HDF5 Fortran example and paste it on a new Visual Studio Fortran project. Fortran example source-code (here)

  4. Then, under Project Properties | Fortran | General | Additional Include Directories insert the path to the location of hdf5.mod
    In my machine is: C:\Program Files\HDF_Group\HDF5\1.10.5\include\static

  5. To link, under Project | Properties | Linker | General | Additional Library Directories insert the path the location of the .lib files
    In my machine is: C:\Program Files\HDF_Group\HDF5\1.10.5\lib

  6. Then, under Project | Properties | Linker | Input | Additional Dependencies insert ONLY the hdf5_fortran.lib

  7. I did all these configurations for All Configurations and All Platforms.
    My active VS environment is Debug - x64.

==> My Problem:
I right-clicked in the Fortran solution name and “Build”, but I got these linker errors:

unresolved external symbol H5GLOBAL_mp_H5T_NATIVE_INTEGER
unresolved external symbol H5GLOBAL_mp_H5FD_MEM_NTYPES_F
unresolved external symbol H5GLOBAL_mp_H5F_ACC_TRUNC_F

a) What I have to do now to solve it?

b) The HDF5 binary installer name (hdf5-1.10.5-Std-win10_64-vs15.zip) have this vs15 inside the filename. I don’t know, but I think that it means “Visual Studio 2015”. Is there any problem to use these C and Fortran HDF5 libraries inside of Visual Studio 2019 x64?

My system is:

  • Windows 10 x64
  • Visual Studio 2019 Enterprise
  • Intel Visual Fortran 2019

Thank you,

==> UPDATE 1:
I saw the HDF5 tutorial on the offical documentation that instructs how to build the Fortran library, but it doesn’t work too:

To test it, using the Windows console, I went to my HDF5 downloaded source folder:
In my machine is here: C:\Users\lamar\Downloads\CMake-hdf5-1.10.5 and I typed: build-VS2017-64.bat

PS.: My installed Visual Studio version is 2019 x64, but inside the downloaded HDF5 source folder only have these options:

  • VS 2013 (32/64)
  • VS 2015 (32/64)
  • VS 2017 (32/64)

So, I got this errors in the console window:

ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -V -O hdf5.log
-- Dashboard script configuration:
  CTEST_SITE=[WIN7VS201764.XXXX]
  CTEST_BUILD_NAME=[Windows-WIN7-vs2017]
  CTEST_SOURCE_DIRECTORY=[C:/Users/lamar/Downloads/CMake-hdf5-1.10.5\hdf5-1.10.5]
  CTEST_BINARY_DIRECTORY=[C:/Users/lamar/Downloads/CMake-hdf5-1.10.5\build]
  CTEST_CMAKE_GENERATOR=[Visual Studio 15 2017 Win64]
  CTEST_CONFIGURATION_TYPE=[Release]
  CTEST_GIT_COMMAND=[]
  CTEST_CHECKOUT_COMMAND=[]
  CTEST_CONFIGURE_COMMAND=["C:/Program Files/cmake/bin/cmake.exe" -C "C:/Users/lamar/Downloads/CMake-hdf5-1.10.5\hdf5-1.10.5/config/cmake/cacheinit.cmake" -DCMAKE_BUILD_TYPE:STRING=Release  -DHDF5_BUILD_FORTRAN:BOOL=OFF -DHDF5_BUILD_JAVA:BOOL=OFF -DCMAKE_INSTALL_PREFIX:PATH=C:/Program Files/HDF_Group/HDF5/1.10.5 -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=C:/Users/lamar/Downloads/CMake-hdf5-1.10.5 -DHDF5_PACKAGE_EXTLIBS:BOOL=ON -DSITE:STRING=WIN7VS201764.XXXX -DBUILDNAME:STRING=Windows-WIN7-vs2017 "-GVisual Studio 15 2017 Win64" "" "C:/Users/lamar/Downloads/CMake-hdf5-1.10.5\hdf5-1.10.5"]
  CTEST_SCRIPT_DIRECTORY=[C:/Users/lamar/Downloads/CMake-hdf5-1.10.5]
  CTEST_USE_LAUNCHERS=[]


Run dashboard with model Experimental
   Source directory: C:/Users/lamar/Downloads/CMake-hdf5-1.10.5\hdf5-1.10.5
   Build directory: C:/Users/lamar/Downloads/CMake-hdf5-1.10.5\build
   Track: Experimental
   Reading ctest configuration file: C:/Users/lamar/Downloads/CMake-hdf5-1.10.5/hdf5-1.10.5/CTestConfig.cmake
   Site: WIN7VS201764.XXXX
   Build name: Windows-WIN7-vs2017
   Use Experimental tag: 20190930-1901
Configure project
   Each . represents 1024 bytes of output
    . Size of output: 0K
Error(s) when configuring the project
Build project
   Each symbol represents 1024 bytes of output.
   '!' represents an error and '*' a warning.
    ! Size of output: 0K
Error(s) when building project
   1 Compiler errors
   1 Compiler warnings
Test project C:/Users/lamar/Downloads/CMake-hdf5-1.10.5/build
No tests were found!!!

The binaries available for download are always built with CMake’s “RelWithDebInfo” which is not compatible with “Debug” as it uses the standard runtime library. You would need to build HDF5 from source in “Debug” mode.

I would think you should be able to use VS2019 to build HDF5, but I do not have experience with that yet. Either edit the ctest files to select VS2019 (and the latest CMake installed) or start in a VS2017 compatible command window.

Allen

1 Like