Correct flags for HDF5 during compiling code


Hope you are doing well.

I am compiling a code that required hdf5 for data analysis. I plan to run the code on a cluster which already has a module for hdf5.

So first I am doing

module load hdf5

The version is hdf5-1.10.7. Now in my Makefile.h file for the code:

FCOMP = $(HDF5_PATH)/bin/h5pfc
CCOMP = $(HDF5_PATH)/bin/h5pcc
LINK = $(HDF5_PATH)/bin/h5pfc -std=c++14
FFLAGS_HDF5 = -I${HDF5_PATH}/include -DH5_USE_18_API
CFLAGS_HDF5 = -I{HDF5_PATH}/include -DH5_USE_18_API
LIB_HDF5 = -L${HDF5_PATH}/lib -lhdf5_fortran -lhdf5 -lz

When I try to compile , I get the following error:
dir is /cvmfs/
/cvmfs/ file not recognized: Is a directory

From what I can gather, the compilation is trying to find a particular file instead of the lib directory. Do I change any of the flags?. Should I change the HDF5_PATH?

Best wishes,

Since you are using the compilation wrappers, you should not need to set all the links, includes, etc.
All you need to do is h5pcc your_program.c in your makefile. If you need to set additional options, use HDF5_CPPFLAGS, HDF5_CFLAGS, etc. See h5pcc -help for more information.