How to use HDF5 1.10.2 with Intel Fortran with Visual Studio 2015

Dear There,
I found HDF5 is very powerful I/O software tool. I just installed HDF5 1.10.2 in my machine, which is a desktop having Window 10, Intel FORTRAN 2017 with Visual Studio 2015.
I try to run a test example,h5ex_g_create.f90 , from the example folder, after I set the include path to “C:\Program Files\HDF_Group\HDF5\1.10.2\include\static”, lib path to “C:\Program Files\HDF_Group\HDF5\1.10.2\lib”, and additional libs are hdf5.lib hdf5_fortran.lib.
I got linking error as follow.

error LNK2019: unresolved external symbol H5GLOBAL_mp_H5F_ACC_TRUNC_F referenced in function H5EX_G_CREATE h5ex_g_create.obj
error LNK2001: unresolved external symbol H5GLOBAL_mp_H5FD_MEM_NTYPES_F h5ex_g_create.obj

Since I’m new to use HDF5, please tell me the wrong I made, and how to fix it? It is better to pass me the reference that teaches how to use HDF5 in FORTRAN.

 Thanks,

 Ning

The include path should also have the “include” without the static. Linking static requires all libs in the chain, which includes the *_cstub libraries.

I recommend using the cmake build scripts as cmake will take care of dependencies. You can always open up the generated VS solution to inspect the settings.

Allen

Dear Byrn

  Thanks for your answer. I follow your instruction.
  The additional include path is changed to
         C:\Program Files\HDF_Group\HDF5\1.10.2\include
         C:\Program Files\HDF_Group\HDF5\1.10.2\include\static
  The additional library path is changed to
         C:\Program Files\HDF_Group\HDF5\1.10.2\lib
  The input link to additional libs to
        szip.lib zlib.lib hdf5.lib hdf5_fortran.lib hdf5_hl.lib hdf5_hl_fortran.lib hdf5_f90cstub.lib hdf5_hl_f90cstub.lib

    When the "h5ex_g_create.f90" is compiled, the error occurs again as before, as shown in the below.  

error LNK2019: unresolved external symbol H5GLOBAL_mp_H5F_ACC_TRUNC_F referenced in function H5EX_G_CREATE h5ex_g_create.obj

    So I switch back to 1.10.1. I can compile and run "h5ex_g_create.f90" successfully. When I continue testing with the example code of "h5ex_g_corder.f90", it is compiled successfully. But the running errors rise as listed in the below. I'm fully confused. Could you give some ideas about what wrong and how to fix?

HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5F.c line 491 in H5Fcreate(): unable to create file
major: File accessibilty
minor: Unable to open file
#001: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Fint.c line 1296 in H5F_open(): unable to open file
major: File accessibilty
minor: Unable to open file
#002: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5FD.c line 809 in H5FD_open(): open failed
major: Virtual File Layer
minor: Unable to initialize object
#003: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5FDsec2.c line 346 in H5FD_sec2_open(): unable to open file: name = ‘h5ex_g_create.h5’, errno = 17, error message = ‘File exists’, flags = 15, o_flags = 502
major: File accessibilty
minor: Unable to open file
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 299 in H5Gcreate2(): not a location
major: Invalid arguments to routine
minor: Inappropriate type
#001: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Gloc.c line 251 in H5G_loc(): invalid object ID
major: Invalid arguments to routine
minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 723 in H5Gclose(): not a group
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 462 in H5Gopen2(): not a location
major: Invalid arguments to routine
minor: Inappropriate type
#001: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Gloc.c line 251 in H5G_loc(): invalid object ID
major: Invalid arguments to routine
minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 723 in H5Gclose(): not a group
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5F.c line 762 in H5Fclose(): not a file ID
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5F.c line 491 in H5Fcreate(): unable to create file
major: File accessibilty
minor: Unable to open file
#001: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Fint.c line 1296 in H5F_open(): unable to open file
major: File accessibilty
minor: Unable to open file
#002: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5FD.c line 809 in H5FD_open(): open failed
major: Virtual File Layer
minor: Unable to initialize object
#003: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5FDsec2.c line 346 in H5FD_sec2_open(): unable to open file: name = ‘h5ex_g_corder.h5’, errno = 17, error message = ‘File exists’, flags = 15, o_flags = 502
major: File accessibilty
minor: Unable to open file
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5P.c line 252 in H5Pcreate(): not a property list class
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Pgcpl.c line 469 in H5Pset_link_creation_order(): can’t find object for ID
major: Object atom
minor: Unable to find atom information (already closed?)
#001: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Pint.c line 3815 in H5P_object_verify(): property list is not a member of the class
major: Property lists
minor: Unable to register new atom
#002: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Pint.c line 3765 in H5P_isa_class(): not a property list
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 299 in H5Gcreate2(): not a location
major: Invalid arguments to routine
minor: Inappropriate type
#001: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Gloc.c line 251 in H5G_loc(): invalid object ID
major: Invalid arguments to routine
minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 299 in H5Gcreate2(): not a location
major: Invalid arguments to routine
minor: Inappropriate type
#001: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Gloc.c line 251 in H5G_loc(): invalid object ID
major: Invalid arguments to routine
minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 723 in H5Gclose(): not a group
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 299 in H5Gcreate2(): not a location
major: Invalid arguments to routine
minor: Inappropriate type
#001: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Gloc.c line 251 in H5G_loc(): invalid object ID
major: Invalid arguments to routine
minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 723 in H5Gclose(): not a group
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 299 in H5Gcreate2(): not a location
major: Invalid arguments to routine
minor: Inappropriate type
#001: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Gloc.c line 251 in H5G_loc(): invalid object ID
major: Invalid arguments to routine
minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 723 in H5Gclose(): not a group
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 299 in H5Gcreate2(): not a location
major: Invalid arguments to routine
minor: Inappropriate type
#001: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5Gloc.c line 251 in H5G_loc(): invalid object ID
major: Invalid arguments to routine
minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 723 in H5Gclose(): not a group
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 551 in H5Gget_info(): invalid argument
major: Invalid arguments to routine
minor: Bad value
Traversing group using alphabetical indices:

Traversing group using creation order indices:
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5P.c line 1513 in H5Pclose(): not a property list
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5G.c line 723 in H5Gclose(): not a group
major: Invalid arguments to routine
minor: Inappropriate type
HDF5-DIAG: Error detected in HDF5 (1.10.1) thread 0:
#000: C:\autotest\hdf5110-StdRelease-code-10vs14\build\hdfsrc\src\H5F.c line 762 in H5Fclose(): not a file ID
major: Invalid arguments to routine
minor: Inappropriate type

   Ning An