Below are steps to compile a program which uses hdf5.
Load the appropriate hdf5+compiler module
Use module avail to see a list of hdf5+compiler options. Below is one possible choice:
module load hdf5_1.8.13-icc_15.0
Compiling using a Makefile
If you are using a Makefile then inside your Makefile you should have lines similar to below:
FFLAGS = -O3 -fp-model source -I/sw/hdf5-1.8.13_icc-15.0/include
LDFLAGS = -L/usr/lib64 -L/sw/hdf5-1.8.13_icc-15.0/lib -lhdf5
Now you can run make.
Compiling at command line
If you are compiling your code at the command line then you should issue commands similar to below commands:
export FFLAGS = -O3 -fp-model source -I/sw/hdf5-1.8.13_icc-15.0/include
export LDFLAGS = -L/usr/lib64 -L/sw/hdf5-1.8.13_icc-15.0/lib -lhdf5
Now you can run the compiler.
(1) The "-O3 -fp-model source" and "-L/usr/lib64" can be replaced by your choice of compiler and linker flags.
(2) The underscores and dashes in the module name and corresponding directory on /sw are not at the same place.
(3) More details are here: https://www.hdfgroup.org/HDF5/Tutor/compile.html
(4) Use below command to find location of hdf5: