Please see The HDF Group's new Support Portal for the latest information.
The questions below are specific to Windows only. PLEASE note that we do not provide Visual Studio projects and solutions with the source code. Instead, you construct the required projects and solutions for your compiler and platform using CMake, and then build the library using Visual Studio. Also note that building HDF5-based software using the pre-built libraries does not require CMake.
CMake
- How do I use CMake to compile an application using the HDF5 pre-built binaries ?
- How do I build HDF5 from source with CMake ?
- How do I build HDF5 with SZIP and ZLIB from source with CMake ?
- Public CDash Submission Guidelines
Visual Studio
- How do I use the HDF5 pre-built binaries to compile Visual Studio applications ?
- Checklist for compiling with VS
Other
CMake
How do I use CMake to compile an application using the HDF5 pre-built binaries ?
Download the binary and unzip it. You can get that from the table at the bottom of the Obtain Latest page. Then:
-
You will see an .exe file in the resulting directory. Run the .exe file. This brings up an HDF5 Setup Wizard, which installs the software. The directory that gets installed will include the HDF5 include files, libraries, and utilities (and some additional files).
-
Follow the USING_HDF5_CMake.txt file for instructions on compiling an application.
How do I build HDF5 from source with CMake ?
The preferred method to build HDF5 from source using CMake is to use the configuration scripts that we provide. See the Building With CMake page for details on using these scripts.
Then follow the instructions in the INSTALL_CMake.txt file.
Public CDash Submission Guidelines
The CDash server for community submissions of hdf5 1.8 is at https://cdash.hdfgroup.org.
Submitters are requested to register their name and contact info and maintain their test sites. After your first submission, login and go to your "My CDash" link and claim your site.
We ask that all submissions include the configuration information and contact information in the CTest Notes Files upload step. See the current reports on CDash for examples.
Please follow the convention that "NIGHTLY" submissions maintain the same configuration every time. "EXPERIMENTAL" submissions can be expected to be different for each submission.
Visual Studio and CMake
How do I use the HDF5 pre-built binaries to compile Visual Studio applications ?
Here are the basic steps for compiling VS applications using the HDF5 pre-built CMake binaries:
-
First, make sure you use the same version of Visual Studio that was used to create the pre-built binaries. This is required to avoid runtime errors.
-
Secondly, please note that the pre-built binaries are built in release mode with debug information enabled.
-
Download the HDF5 pre-compiled binaries for Windows from the table at the bottom of the Obtain the Latest HDF5 Software page. Unzip these binaries.
-
You will find a file ending in ".exe" in the top directory of the unzipped file. Run that executable to install the HDF5 libraries and include files. This brings up an HDF5 Setup Wizard, which installs the software. The directory that gets installed will include the HDF5 include files, libraries, and utilities (and some additional files).
-
Invoke Visual Studio and build an application.
Before you can build an HDF5 application, you will need to add the following to Visual Studio:
- Add the path to the HDF5 include files.
- Add the path to the HDF5 libraries.
- Add the HDF5 library names that are used (to the Additional Dependencies).
See the USING HDF5_VS.txt file in the source code for further information on building an application using Visual Studio using the HDF5 CMake pre-built binaries.
OUTDATED: Example steps to build applications with MS VS C++ 2010 Express and the HDF5 pre-compiled binaries
Following are steps that were used to create an application using VS C++ 2010 with the HDF5 pre-compiled binaries. They are provided as an example of how a user might do this. The steps may differ with other versions of VS.
-
Create or open a project in Visual Studio that is a Win32 Console Application. For a new project click on the File pulldown menu and select:
File -> New -> Project
-
Add the HDF5 include and library paths to the project, as well as the HDF5 library names. This can be done from the Property Pages window. Click on:
Project -> <Project Name> Properties...
Project is a pull-down menu listed at the top. You will see <Project Name> Properties... at the bottom of this menu. Select it. This will pop up the Property Pages window. From this window, you can add the paths to the HDF5 include and library files, as well as the HDF5 library names.
-
You will see Common Properties and Configuration Properties listed on the left side of the Property Pages window. If nothing is listed under Configuration Properties, then select it and double-click with the left mouse button to show the properties that you can change. You will see:
Common Properties Configuration Properties General Debugging VC++ Directories C/C++ Linker . . .
-
Left Mouse Click on VC++ Directories:
Configuration Properties -> VC++ Directories
On the right of the page you should then see several directories that you can modify.
Select Include Directories, and add the path to the HDF5 include files. (For example:c:\Program Files\HDF Group\HDF5-1.8\include
)
Select Library Directories, and add the path to the HDF5 library files. (For example:c:\Program Files\HDF Group\HDF5-1.8\lib
) -
Left Double Mouse Click on Linker and click on Input:
Configuration Properties -> Linker -> Input
You will see items listed on the right, including Additional Dependencies at the top. Enter the library names there. The external libraries should be listed first, followed by the HDF5 library, and then optionally the HDF5 High Level, Fortran or C++ libraries. For example, to compile a C++ application with the shared HDF5 libraries, enter:
szip.lib;zlib.lib;hdf5.lib;hdf5_cpp.lib
-
You should now be ready to compile and run an HDF5 application.
Checklist for compiling with VS
Compiling on VS using binaries built with CMake is virtually the same as if using binaries built with legacy VS. Please check the following if you are having problems compiling:
Are you using the same version of Visual Studio as was used to build the HDF5 binaries? This is required.
- Which C-runtime are you compiling for? Select:
Project -> <Project Name> Properties
The Property Pages window pops up. From there select:
Configuration Properties -> C/C++ -> Code Generation -> Runtime Library
NOTE:
The runtime should be /MD or /MDd whether you are building dynamically or statically.
Using /MT or /MTd, requires advanced changes to the supplied HDF5 libraries. - Are the HDF5 include file and library paths correct? Select:
Project -> <Project Name> Properties
The Property Pages window pops up. From there select:
Configuration Properties -> VC++ Directories
In the list that is displayed on the right, check the paths for the:
Include Directories Library Directories
- Are the HDF5 library names listed as additional dependencies? Select:
Project -> <Project Name> Properties
The Property Pages window pops up. From there select:
Configuration Properties -> Linker -> Input -> Additional Dependencies
The library names are DIFFERENT for static or dynamic linking.
For static linking you might include for example:
libszip.lib; libzlib.lib; libhdf5.lib
For dynamic linking you might include for example:szip.lib; zlib.lib; hdf5.lib
The order that the libraries are listed is important. The external libraries should be listed first, followed by the HDF5 library, and then optionally the HDF5 High Level, HDF5 Fortran or HDF5 C++ libraries.
- Has the bin/ directory been added to the PATH variable?
The bin/ directory needs to be added to the PATH variable, because the HDF5 DLLs are typically placed in the bin/ directory. The DLLs are required for running an application.
When installing the HDF5 pre-compiled binaries, you are asked if you wish to add HDF5 to the PATH variable. (This occurs when you run the .exe.) If you select yes then the bin/ directory will be added to PATH and will be globally accessible. If you select no, then you will need to manually add the bin/ directory to the PATH variable.
Other
Windows error, "PATH too long ..."
As part of the HDF5 installation on Windows, a user can select to add the path to the system path. If there is not enough space to accommodate the HDF5 path in the system path, an error will occur indicating that the path is too long.
This is a general Windows issue that is documented in many places online.
The solution is to clean up and shorten the system path prior to the installation or to not choose to add the HDF5 path to the system path. The following page (for the Java product!) has information on how to resolve this issue with different versions of Windows.
- - Last modified: 28 September 2016