# C++ Users' Group

**URL:** https://forum.hdfgroup.org/c/hdf5/cpp-users-group/12.md

[Latest](https://forum.hdfgroup.org/latest.md) · [Categories](https://forum.hdfgroup.org/categories.md)

---

## [About the C++ Users' Group category](https://forum.hdfgroup.org/t/about-the-c-users-group-category/4217)

<div class="topic-metadata">

**Author:** [@su-loric](https://forum.hdfgroup.org/u/su-loric)\
**Replies:** 0

</div>

This category is for discussing the use of C++ with HDF5.

---

## [C++ equivalence of Python code for HDF5. Working with datasets resizing, working with indexes \[i\]\[j\] in array-like structures, etc](https://forum.hdfgroup.org/t/c-equivalence-of-python-code-for-hdf5-working-with-datasets-resizing-working-with-indexes-i-j-in-array-like-structures-etc/13836)

<div class="topic-metadata">

**Author:** [@mlt.2](https://forum.hdfgroup.org/u/mlt.2)\
**Replies:** 8\
**Last updated:** [June 22, 2026, 9:16pm UTC](https://forum.hdfgroup.org/t/c-equivalence-of-python-code-for-hdf5-working-with-datasets-resizing-working-with-indexes-i-j-in-array-like-structures-etc/13836 "2026-06-22T21:16:30Z")

</div>

This post is about code conversion from Python to C++ about HDF5, trying to keep the C++ part simplified, and this about a specific part from a previous post here, just in order to separate that whole content in separate…

---

## [C++ equivalence of Python code for HDF5. Is possible to write 2d std::vector to HDF5 file similarly to 2d std::array? or more simplified in general](https://forum.hdfgroup.org/t/c-equivalence-of-python-code-for-hdf5-is-possible-to-write-2d-std-vector-to-hdf5-file-similarly-to-2d-std-array-or-more-simplified-in-general/13832)

<div class="topic-metadata">

**Author:** [@mlt.2](https://forum.hdfgroup.org/u/mlt.2)\
**Replies:** 4\
**Last updated:** [June 16, 2026, 5:12pm UTC](https://forum.hdfgroup.org/t/c-equivalence-of-python-code-for-hdf5-is-possible-to-write-2d-std-vector-to-hdf5-file-similarly-to-2d-std-array-or-more-simplified-in-general/13832 "2026-06-16T17:12:56Z")

</div>

This post is about code conversion from Python to C++ about HDF5, trying to keep the C++ part simplified. General process in the program about HDF5: Generate a .h5 file with one or more datasets. Writing/reading if th…

---

## [Unable to make HDF5 and HDFView work, both at the same time, neither with the .msi HDF5 installation nor with the vcpkg HDF5 installation](https://forum.hdfgroup.org/t/unable-to-make-hdf5-and-hdfview-work-both-at-the-same-time-neither-with-the-msi-hdf5-installation-nor-with-the-vcpkg-hdf5-installation/13824)

<div class="topic-metadata">

**Author:** [@mlt.2](https://forum.hdfgroup.org/u/mlt.2)\
**Replies:** 4\
**Last updated:** [June 15, 2026, 7:23pm UTC](https://forum.hdfgroup.org/t/unable-to-make-hdf5-and-hdfview-work-both-at-the-same-time-neither-with-the-msi-hdf5-installation-nor-with-the-vcpkg-hdf5-installation/13824 "2026-06-15T19:23:56Z")

</div>

I’m trying to work with HDF5 in a cpp program and at the same time also with HDFView (v3.4.1, currently the most recent version). I’m new with HDF5 and currently I’m trying to work with the next program example: h5tutr…

---

## [Need clarification of how to read variable length strings in C code](https://forum.hdfgroup.org/t/need-clarification-of-how-to-read-variable-length-strings-in-c-code/13814)

<div class="topic-metadata">

**Author:** [@shawn.fox](https://forum.hdfgroup.org/u/shawn.fox)\
**Replies:** 1\
**Last updated:** [June 3, 2026, 12:01pm UTC](https://forum.hdfgroup.org/t/need-clarification-of-how-to-read-variable-length-strings-in-c-code/13814 "2026-06-03T12:01:40Z")

</div>

Looking at the H5Dread API, it isn’t clear to me whether the caller should allocate the memory of the buffer. It only shows one example for a data type of integer and the caller does create the memory buffer before makin…

---

## [Typical format using HDF5+XDMF to save a AMR](https://forum.hdfgroup.org/t/typical-format-using-hdf5-xdmf-to-save-a-amr/13755)

<div class="topic-metadata">

**Author:** [@dreamerking](https://forum.hdfgroup.org/u/dreamerking)\
**Replies:** 6\
**Last updated:** [April 14, 2026, 1:31am UTC](https://forum.hdfgroup.org/t/typical-format-using-hdf5-xdmf-to-save-a-amr/13755 "2026-04-14T01:31:46Z")

</div>

Hi there,all! I’m new to HDF5, and am working on an AMR generator recently. I want to use HDF5+XDMF to save the AMR as an .h5 and an .xdmf file. The structure of my AMR is like this: The mesh has N block, and each bl…

---

## [Writing compound datatype with internal vector](https://forum.hdfgroup.org/t/writing-compound-datatype-with-internal-vector/13392)

<div class="topic-metadata">

**Author:** [@zarahtaufique](https://forum.hdfgroup.org/u/zarahtaufique)\
**Replies:** 1\
**Last updated:** [August 5, 2025, 5:02pm UTC](https://forum.hdfgroup.org/t/writing-compound-datatype-with-internal-vector/13392 "2025-08-05T17:02:17Z")

</div>

Hello! I’m working on writing a compound datatype to an HDF5 dataset using C++. My struct includes an internal std::vector whose length is consistent across all instances, but can vary depending on user input. My struc…

---

## [Optimize compression performance](https://forum.hdfgroup.org/t/optimize-compression-performance/13226)

<div class="topic-metadata">

**Author:** [@michael.goelzer](https://forum.hdfgroup.org/u/michael.goelzer)\
**Replies:** 2\
**Last updated:** [May 2, 2025, 7:06am UTC](https://forum.hdfgroup.org/t/optimize-compression-performance/13226 "2025-05-02T07:06:13Z")

</div>

I have a very simple prototype that is mostly based upon examples from the “Learning the Basics” chapter, in particular the C++ version of “Create a chunked and compressed dataset”. Right now, this prototype is severely …

---

## [Seeking guidance on C++ wrappers](https://forum.hdfgroup.org/t/seeking-guidance-on-c-wrappers/13182)

<div class="topic-metadata">

**Author:** [@jgrad](https://forum.hdfgroup.org/u/jgrad)\
**Replies:** 4\
**Last updated:** [April 11, 2025, 4:19pm UTC](https://forum.hdfgroup.org/t/seeking-guidance-on-c-wrappers/13182 "2025-04-11T16:19:19Z")

</div>

Dear all, I am currently in the process of modernizing a C++ scientific software project that leverages parallel HDF5 through a C++ wrapper library. Due to compatibility issues with recent HDF5 releases, I looked into a…

---

## [Trouble linking and using HDF5 C++ API with Visual Studio 2022 (version 1.14.6)](https://forum.hdfgroup.org/t/trouble-linking-and-using-hdf5-c-api-with-visual-studio-2022-version-1-14-6/13183)

<div class="topic-metadata">

**Author:** [@a.horita](https://forum.hdfgroup.org/u/a.horita)\
**Replies:** 2\
**Last updated:** [April 10, 2025, 11:37pm UTC](https://forum.hdfgroup.org/t/trouble-linking-and-using-hdf5-c-api-with-visual-studio-2022-version-1-14-6/13183 "2025-04-10T23:37:33Z")

</div>

Hello, I’m trying to use the HDF5 C++ API in my project with Visual Studio 2022 on Windows, but I’m having trouble getting it to work properly. I downloaded the following pre-built binary from the HDF Group website: h…

---

## [Improving Parallel I/O performance](https://forum.hdfgroup.org/t/improving-parallel-i-o-performance/13165)

<div class="topic-metadata">

**Author:** [@srvenkat](https://forum.hdfgroup.org/u/srvenkat)\
**Replies:** 4\
**Last updated:** [April 9, 2025, 1:57am UTC](https://forum.hdfgroup.org/t/improving-parallel-i-o-performance/13165 "2025-04-09T01:57:04Z")

</div>

I am using the HighFive library on the NERSC Perlmutter system. I have an application that has to do parallel reads/writes, and I was following the parallel collective I/O example from the HighFive repo: GitHub - highfiv…

---

## [Undefined references when building GDAL with HDF5 with VCPKG](https://forum.hdfgroup.org/t/undefined-references-when-building-gdal-with-hdf5-with-vcpkg/13152)

<div class="topic-metadata">

**Author:** [@rob.thepvcman](https://forum.hdfgroup.org/u/rob.thepvcman)\
**Replies:** 3\
**Last updated:** [April 4, 2025, 3:53am UTC](https://forum.hdfgroup.org/t/undefined-references-when-building-gdal-with-hdf5-with-vcpkg/13152 "2025-04-04T03:53:04Z")

</div>

I’m trying to install GDAL with HDF5 support in a docker container. The build completes, but when I am building my executable, which links libgdal.a, I get the following undefined references in HDF5: 7): error: undefin…

---

## [Unresolved External Symbol H5::PredType::C\_S1 in HDF5 C++ on Windows 11 (VS2022)](https://forum.hdfgroup.org/t/unresolved-external-symbol-h5-c-s1-in-hdf5-c-on-windows-11-vs2022/13091)

<div class="topic-metadata">

**Author:** [@phemmer](https://forum.hdfgroup.org/u/phemmer)\
**Replies:** 2\
**Last updated:** [March 6, 2025, 1:06pm UTC](https://forum.hdfgroup.org/t/unresolved-external-symbol-h5-c-s1-in-hdf5-c-on-windows-11-vs2022/13091 "2025-03-06T13:06:34Z")

</div>

Problem Summary I am encountering a linker error in Visual Studio 2022 on Windows 11 when trying to use H5::PredType::C\_S1 in the HDF5 C++ API. The same project works fine on a different machine running Windows 10 with V…

---

## [HDF5 Union/Variant Support](https://forum.hdfgroup.org/t/hdf5-union-variant-support/12976)

<div class="topic-metadata">

**Author:** [@zarahtaufique](https://forum.hdfgroup.org/u/zarahtaufique)\
**Replies:** 1\
**Last updated:** [January 16, 2025, 1:19pm UTC](https://forum.hdfgroup.org/t/hdf5-union-variant-support/12976 "2025-01-16T13:19:14Z")

</div>

Hello! I have defined a compound datatype in HDF5 that is closely tied to a struct. To save memory, I was considering adding a union or variant to the struct. However, I anticipate that this might cause issues with the c…

---

## [Writing Binary Representation to HDF5](https://forum.hdfgroup.org/t/writing-binary-representation-to-hdf5/12957)

<div class="topic-metadata">

**Author:** [@zarahtaufique](https://forum.hdfgroup.org/u/zarahtaufique)\
**Replies:** 2\
**Last updated:** [January 14, 2025, 8:41pm UTC](https://forum.hdfgroup.org/t/writing-binary-representation-to-hdf5/12957 "2025-01-14T20:41:34Z")

</div>

Hello! I was wondering if there is a way to write the binary representation of a uint8\_t to single cell in a HDF5 data table. Currently, I have a struct with integers (uint8\_t) that I am writing to HDF5, but I want thos…

---

## [H5::Exception::Muter RAII dontPrint() wrapper](https://forum.hdfgroup.org/t/h5-muter-raii-dontprint-wrapper/12896)

<div class="topic-metadata">

**Author:** [@ericboesch](https://forum.hdfgroup.org/u/ericboesch)\
**Replies:** 1\
**Last updated:** [January 3, 2025, 5:37pm UTC](https://forum.hdfgroup.org/t/h5-muter-raii-dontprint-wrapper/12896 "2025-01-03T17:37:23Z")

</div>

I’m pretty new to the C++ HDF5 library, but… any thoughts whether something like this quickie would be worth adding to the code base? Simple but not obvious to newbies. /\*\* Instantiating this class invokes H5::Exception…

---

## [Unable to write the same vector several times?](https://forum.hdfgroup.org/t/unable-to-write-the-same-vector-several-times/12915)

<div class="topic-metadata">

**Author:** [@gerard.henry](https://forum.hdfgroup.org/u/gerard.henry)\
**Replies:** 4\
**Last updated:** [December 20, 2024, 4:02pm UTC](https://forum.hdfgroup.org/t/unable-to-write-the-same-vector-several-times/12915 "2024-12-20T16:02:14Z")

</div>

hello all, i am tring this code on ubuntu 22 LTS: #include "H5Cpp.h" // Include the HDF5 C++ API header #include \<iostream\> #include \<vector\> using namespace H5; int main() { // File name and dataset name co…

---

## [Difficulty Reading Large HDF5 Files on Multi-Node Systems](https://forum.hdfgroup.org/t/difficulty-reading-large-hdf5-files-on-multi-node-systems/12824)

<div class="topic-metadata">

**Author:** [@sheetgb](https://forum.hdfgroup.org/u/sheetgb)\
**Replies:** 1\
**Last updated:** [December 3, 2024, 6:17pm UTC](https://forum.hdfgroup.org/t/difficulty-reading-large-hdf5-files-on-multi-node-systems/12824 "2024-12-03T18:17:29Z")

</div>

Hello HDF5 Community, I’m encountering an issue with reading large HDF5 files (500GB+) on a multi-node HPC system. Specifically, when using parallel I/O with MPI, I’ve noticed: Slow Read Performance: The read times a…

---

## [HDF5 File Locking Mechanism](https://forum.hdfgroup.org/t/hdf5-file-locking-mechanism/12703)

<div class="topic-metadata">

**Author:** [@jonathan.royon.ext](https://forum.hdfgroup.org/u/jonathan.royon.ext)\
**Replies:** 1\
**Last updated:** [October 2, 2024, 5:08pm UTC](https://forum.hdfgroup.org/t/hdf5-file-locking-mechanism/12703 "2024-10-02T17:08:19Z")

</div>

Hi all, I’ve been experimenting with the HDF5 file locking mechanism and encountered some unexpected behavior (hdf5 1.14.4). Below is the code snippet I used to test the file locking: #include "hdf5.h" #include "H5Cpp.…

---

## [Requirements for an offline build](https://forum.hdfgroup.org/t/requirements-for-an-offline-build/12693)

<div class="topic-metadata">

**Author:** [@nicholas.desmarais](https://forum.hdfgroup.org/u/nicholas.desmarais)\
**Replies:** 2\
**Last updated:** [September 26, 2024, 1:21pm UTC](https://forum.hdfgroup.org/t/requirements-for-an-offline-build/12693 "2024-09-26T13:21:20Z")

</div>

Hello, My team builds HDF5 from source for use in our c++ libraries. We have some systems which are not allowed to have access to the internet, but would still like to be able to build from source on them. I was wonder…

---

## [Map struct member in array to simple 1d dataset](https://forum.hdfgroup.org/t/map-struct-member-in-array-to-simple-1d-dataset/12591)

<div class="topic-metadata">

**Author:** [@urs.schroffenegger](https://forum.hdfgroup.org/u/urs.schroffenegger)\
**Replies:** 6\
**Last updated:** [August 16, 2024, 7:05am UTC](https://forum.hdfgroup.org/t/map-struct-member-in-array-to-simple-1d-dataset/12591 "2024-08-16T07:05:12Z")

</div>

Hi, I’m prototyping some code to read and write our particle simulation input and output to an HDF5 file in a specific structure (h5part) that I could open in a visualisation software (paraview). The format contains so…

---

## [C++ H5File Copy Constructor with and without thread safe option.](https://forum.hdfgroup.org/t/c-h5file-copy-constructor-with-and-without-thread-safe-option/12483)

<div class="topic-metadata">

**Author:** [@william.helsby](https://forum.hdfgroup.org/u/william.helsby)\
**Replies:** 1\
**Last updated:** [July 1, 2024, 7:59pm UTC](https://forum.hdfgroup.org/t/c-h5file-copy-constructor-with-and-without-thread-safe-option/12483 "2024-07-01T19:59:26Z")

</div>

I am writing code to acquire data from an X-ray detector and write to an hdf5 file. The code is to write data from a circular buffer (in an FPGA accelerator card) to one or more hdf5 files. Although the hdf5 library is …

---

## [Building with zlib (and szip) on windows](https://forum.hdfgroup.org/t/building-with-zlib-and-szip-on-windows/12332)

<div class="topic-metadata">

**Author:** [@hdf51](https://forum.hdfgroup.org/u/hdf51)\
**Replies:** 12\
**Last updated:** [June 17, 2024, 12:57pm UTC](https://forum.hdfgroup.org/t/building-with-zlib-and-szip-on-windows/12332 "2024-06-17T12:57:09Z")

</div>

I’m trying to build hdf5 with sz and zlib support, but I got very confused; I can’t figure out an easy way how to. My main question probably is - can somebody point me to a tutorial or writeup where it is described how …

---

## [How exactly H5Dget\_type works](https://forum.hdfgroup.org/t/how-exactly-h5dget-type-works/12346)

<div class="topic-metadata">

**Author:** [@gouyon](https://forum.hdfgroup.org/u/gouyon)\
**Replies:** 5\
**Last updated:** [May 28, 2024, 10:47am UTC](https://forum.hdfgroup.org/t/how-exactly-h5dget-type-works/12346 "2024-05-28T10:47:21Z")

</div>

Hello I am new to HDF5 and I don’t understand how the H5Dget\_type function works. I wanted to use it to know what type of data are stored in a dataset. To test I use a H5 file with different data set one is an array o…

---

## [How to know what is in a H5 file](https://forum.hdfgroup.org/t/how-to-know-what-is-in-a-h5-file/12311)

<div class="topic-metadata">

**Author:** [@gouyon](https://forum.hdfgroup.org/u/gouyon)\
**Replies:** 2\
**Last updated:** [May 22, 2024, 11:37am UTC](https://forum.hdfgroup.org/t/how-to-know-what-is-in-a-h5-file/12311 "2024-05-22T11:37:25Z")

</div>

Hello I use the H5 library in a C program to read H5 files. But I need to know what is in my file (groups, datasets…) I check over internet and found theses functions: /\* Open an existing file. \*/ file\_id = H5Fope…

---

## [A proper way to compile HDF5 plugins](https://forum.hdfgroup.org/t/a-proper-way-to-compile-hdf5-plugins/12303)

<div class="topic-metadata">

**Author:** [@krzysztof.madura](https://forum.hdfgroup.org/u/krzysztof.madura)\
**Replies:** 4\
**Last updated:** [May 20, 2024, 11:37am UTC](https://forum.hdfgroup.org/t/a-proper-way-to-compile-hdf5-plugins/12303 "2024-05-20T11:37:08Z")

</div>

Hello I’m trying to setup programming enviornment. While compiling HDF5 library itself is not a problem at all, trying to compile a single plugin or all plugins (from plugin repo) gives me headaches. For me it feels lik…

---

## [Writing Variable Length Data To Compound Dataset](https://forum.hdfgroup.org/t/writing-variable-length-data-to-compound-dataset/12186)

<div class="topic-metadata">

**Author:** [@nicholas.desmarais](https://forum.hdfgroup.org/u/nicholas.desmarais)\
**Replies:** 4\
**Last updated:** [May 14, 2024, 10:09pm UTC](https://forum.hdfgroup.org/t/writing-variable-length-data-to-compound-dataset/12186 "2024-05-14T22:09:57Z")

</div>

Hello, I am writing a program that converts google protocol buffer messages into the HDF5 file format via the CPP interface, and I seem to be hitting an issue when attempting to copy strings + other variable length fiel…

---

## [Creating virtual file layer](https://forum.hdfgroup.org/t/creating-virtual-file-layer/12244)

<div class="topic-metadata">

**Author:** [@anri1085](https://forum.hdfgroup.org/u/anri1085)\
**Replies:** 2\
**Last updated:** [May 3, 2024, 7:21pm UTC](https://forum.hdfgroup.org/t/creating-virtual-file-layer/12244 "2024-05-03T19:21:42Z")

</div>

I’m trying to write data using the core driver and then get its binary representation in memory: std::vector\<int\> vec = {42, 10, -7, 8, 2, 15}; //data // creating virtual file layer: H5::FileAccPropList fapl; fapl.setC…

---

## [Profiling shows H5C\_protect called by getObjnameByIdx is a bottleneck](https://forum.hdfgroup.org/t/profiling-shows-h5c-protect-called-by-getobjnamebyidx-is-a-bottleneck/12188)

<div class="topic-metadata">

**Author:** [@acu](https://forum.hdfgroup.org/u/acu)\
**Replies:** 3\
**Last updated:** [April 12, 2024, 6:25pm UTC](https://forum.hdfgroup.org/t/profiling-shows-h5c-protect-called-by-getobjnamebyidx-is-a-bottleneck/12188 "2024-04-12T18:25:37Z")

</div>

I have a custom HDF file organization. Using HDF 1.12.1 on Windows x64 - Release build I am reading with C++ code size\_t nDS = resultGroup.getNumObjs(); for ( int iDS = 0; iDS \< nDS; iDS++ ) { std::string d…

---

## [Example of using FetchContent to bring HDF5 ?](https://forum.hdfgroup.org/t/example-of-using-fetchcontent-to-bring-hdf5/12097)

<div class="topic-metadata">

**Author:** [@laurent.aphecetche](https://forum.hdfgroup.org/u/laurent.aphecetche)\
**Replies:** 1\
**Last updated:** [March 22, 2024, 1:20pm UTC](https://forum.hdfgroup.org/t/example-of-using-fetchcontent-to-bring-hdf5/12097 "2024-03-22T13:20:13Z")

</div>

Dear all, I’m looking for a working example of using FetchContent to bring HDF5 (and its CPP wrapper) into a larger CMake build. I’m confused by what exactly I have to define prior to calling FetchContent and, more tri…

[Next page](https://forum.hdfgroup.org/c/hdf5/cpp-users-group/12.md?page=1)
