First of all, I read a similar StackOverflow question here, but it doesn't solved my problem.
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:
I downloaded and installed the HDF5 Windows 10 x64 VS15 binary from the HDF5 official web site (here).
I tested it running this command inside the Windows console:
h5dump.exe. It works good!- So I copy one basic HDF5 Fortran example and paste it on a new Visual Studio Fortran project. Fortran example source-code (here)
- Then, under
Project Properties | Fortran | General | Additional Include Directoriesinsert the path to the location ofhdf5.mod
C:\Program Files\HDF_Group\HDF5\1.10.5\include\static
- To link, under
Project | Properties | Linker | General | Additional Library Directoriesinsert the path the location of the.libfiles.
C:\Program Files\HDF_Group\HDF5\1.10.5\lib
- Then, under
Project | Properties | Linker | Input | Additional Dependenciesinsert ONLY thehdf5_fortran.lib
I did all these configurations for All Configurations and All Platforms.
My active VS environment is Debug - x64.
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
Fortran Example Source-Code:
! This example is used in the HDF5 Tutorial.
PROGRAM H5_CRTDAT
USE HDF5 ! This module contains all necessary modules
IMPLICIT NONE
CHARACTER(LEN=8), PARAMETER :: filename = "dsetf.h5" ! File name
CHARACTER(LEN=4), PARAMETER :: dsetname = "dset" ! Dataset name
INTEGER(HID_T) :: file_id ! File identifier
INTEGER(HID_T) :: dset_id ! Dataset identifier
INTEGER(HID_T) :: dspace_id ! Dataspace identifier
INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/4,6/) ! Dataset dimensions
INTEGER :: rank = 2 ! Dataset rank
INTEGER :: error ! Error flag
!
! Initialize FORTRAN interface.
!
CALL h5open_f(error)
!
! Create a new file using default properties.
!
CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error)
!
! Create the dataspace.
!
CALL h5screate_simple_f(rank, dims, dspace_id, error)
!
! Create the dataset with default properties.
!
CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, &
dset_id, error)
!
! End access to the dataset and release resources used by it.
!
CALL h5dclose_f(dset_id, error)
!
! Terminate access to the data space.
!
CALL h5sclose_f(dspace_id, error)
!
! Close the file.
!
CALL h5fclose_f(file_id, error)
!
! Close FORTRAN interface.
!
CALL h5close_f(error)
END PROGRAM H5_CRTDAT