I would like to use the pre-compiled HDF5 libraries in a CMake project which should be platform independent. The Linux version works very well, under Windows different problems occurred on different systems.
Question #1: Problem on Windows Server 2008, Visual Studio Ultimate 2012
On this machine, CMake 3.7.2 is used to generate the Visual Studio project. This works fine, the versions 1.8.18 and 1.10.1 of the HDF5 libraries are installed and found. The problem appears during compilation, where the header file inttypes.h is not found. This header file belongs somewhat to the C99 standard, which is not supported by some Visual Studio compiler versions. Are there any remedies to this problem?
Question #2: Problem on Windows 10, Visual Studio Enterprise 2017
Here, I installed HDF5 1.10.1 and CMake 3.10 and tried to build my simple example CMake script:
cmake_minimum_required(VERSION 3.2.2)
project(hdf5test)
find_package(HDF5 REQUIRED COMPONENTS C CXX NAMES hdf5)
I followed the advice in USING_HDF5_CMake.txt and set the HDF5_DIR environment variable. But whatever I try, the error:
Could not find a configuration file for package "HDF5" that is compatible with requested version "".
The following configuration files were considered but not accepted: C:/Program Files/HDF_Group/HDF5/1.10.1/cmake/hdf5-config.cmake, version: 1.10.1 (64bit)
always appears. Now I am confused, looks like CMake was on the correct trace but ignored the correct library for some reason. Any ideas why this happens?
Question #3: Problem on Windows 10 (update)
I somehow managed to get the code compiling on the same machine as in #2. The quick fix was to use the module mode of CMake's find_package (the NAMES parameter activates this mode, after removing this parameter I could generate and build the Visual Studio solution.
Then, I added a short C++ code snippet which creates a HDF5 file:
#include "H5Cpp.h"
int main(void)
{
H5::H5File file("test.hdf", H5F_ACC_TRUNC);
}
This code compiles, but when I run it, it gives me the error:
The procedure entry point H5Pset_virtual could not be located in the dynamic link library [...]\hdf5_cpp.dll.
Any ideas?
Related: