Use HDF5 from minGW on windows
I’m trying to compile and link to HDF5 with a Fortran program, but I’m getting a run-time error. I’ve followed closely the procedure described in the answer to this question
I’ve set PATH in the environment variables instead of setting them in visual studio. I moved all of the generated .mod and .lib files to the mod and lib folders in my project folder.
From the command prompt, my compiler config looks like
And my makefile looks like
I’ve changed the hdf5_fortran.lib to libhdf5_fortran.lib because of what I read here
When I run gmake, I get
And when I try to run the executable, a window pops up that says «The application was unable to start correctly (0xc000007b). Click OK to close the application.»
Suggests that it is due to incompatibility of 32-bit to 64-bit. I’m using a 64-bit machine, and I did download a 32-bit version of CMake, but only because there doesn’t seem to be an available version for 64-bit machines. In addition, this link
Suggests that it shouldn’t matter. So my question is, where did I go wrong? Are there any glaring mistakes with what I’ve shown so far?
I found out that the runtime error was due to not specifying a path, in this case HDF5_DIR. In the USING_HDF5_CMAKE document, it says to specify the environment variable
Which fixed the problem of the application crashing at the very start. But now, I’m getting the error
I suppose the first error
Is the most important one since that may trigger later ones. According to this thread
It is suggested that the same compiler is used to build the library as building the fortran source code (if I’m not mistaken). During the build using CMake, I specified to use MinGW, which I believe is used during both builds, right?
Again, any help on this is greatly appreciated.