Missing inttypes.h when compiling HDF5 examples on Windows


I am trying to build the HDF5 examples (tried 1.8.18 and 1.10.1) on Windows Server 2008 using Visual Studio Ultimate 2012. Both with the Visual Studio compiler and the Intel compiler (16.0) I get the error that <inttypes.h> was not found.

At least Intel compiler should support the C99 standard. I have tried passing the flag /Qstd=c99 to the compiler, but still the header file is missing.

Any ideas? Thanks in advance and best regards,

I’ve run into this before, and my understanding is that <inttypes.h> is a common extension and not part of the standard, so isn’t included with some compilers (e.g. MSVC). It shouldn’t be necessary though - it’s mostly just printf-type format macros. <stdint.h> on the other hand defines specific-precision integer types. Which example requires <inttypes.h>?

If it’s being pulled in through <hdf5.h> then check your H5pubconf.h and ensure H5_HAVE_INTTYPES_H is not defined.

Edit: Looks like I added <stdint.h> to my MSVC distro myself… Shouldn’t be necessary though because H5public.h defines the types itself; though it will try to pull in the headers depending on those #defines

Hello Martijn,

thanks for your prompt response. Indeed the H5_HAVE_INTTYPES_H is defined. I tried the quick fix and undefined it, but then some issues with stdbool.h appeared. It is too late to look into this, but I think changing such configure header manually is not very wise… What is the solution here, compile HDF5 on the machine so the configure headers match the system?


Well H5pubconf.h is generated by CMake so running that to correctly configure for your system is probably the best solution. Recompilation seems overkill since changing these includes shouldn’t change anything (even though in principle it could). A workaround for missing <stdbool.h> is also provided in H5public.h as well, so just undefine H5_HAVE_STDBOOL_H too. If you have a CMake install though that’s probably a better approach.

Hello Martijn,

thanks again for your response. I had to undefine H5_HAVE_STDBOOL_H and H5_SIZEOF_BOOL to get the examples compiling. Then some linker issues appeared which I believe are related to the messed up state this ancient Windows Server 2008 installation is in. I think we have to clean up the installation and try again.

Thanks a lot!

Interpreting between the lines, I’m guessing you are using a binary install of HDF5. Because you are using Visual Studio 2012, you should have a HDF5 binary built with VS2012. VS2013 was the first version to support some C99 features.

Also note that 1.8.18 and 1.10.1 are a couple of years old and we have made significant CMake changes to improve the builds of hdf5 since those releases. We do require at least CMake 3.10.2 now. I would encourage you to build HDF5 for your platform as we have not built binaries on Windows Server specifically.
I think you would see fewer issues.

Download info: https://www.hdfgroup.org/downloads/hdf5

Also, please try the 1.10.5 source when it is released (end of this week).


Hello Allen,
thanks for your reply – I will try that!
Regards, Michael