Yes, compile scripts are included in the bin/ directory of the built binaries when building HDF5 from source:
- h5cc (C)
- h5fc (if FORTRAN is enabled)
- h5c++ (if C++ is enabled)
(Below, h5cc is specified but the information is similar for h5fc and h5c++, as well.)
To compile an application, type, h5cc -o prog prog.c where prog is the executable that gets created and prog.c is your application.
If you leave off -o prog then the executable is a.out.
Use h5cc -show to see what libraries and compiler are used by h5cc.
If building the HDF5 library from source, then the compile scripts should be ready to use without changes (if the binaries are not moved).
If using the pre-compiled binaries that we provide, you should be sure to use the same compiler that was used to build the binaries. After you have copied the files to the final installation directory, do the following:
- cd to the bin/ directory in the pre-compiled binaries.
- Run ./h5redeploy and enter yes to the question. This will fix the paths used in h5cc.
This should work in most cases. If it does not, you can edit the h5cc utility and check the values of the variables specified (such as LDFLAGS, LIBS, CPPFLAGS, ..).
Applications included with the built HDF5 binaries
Example programs are included with the built binaries. For Unix, they are found in the share/hdf5_examples/ directory. Execute run-all-ex.sh to compile and run them.
On Windows example programs are provided in the HDF5Examples folder in the top HDF5 directory. Follow the instructions in the USING_CMake_Examples.txt file to build the examples.
see Compiling HDF5 Applications for information on how to compile an application