compile error with hdf5-1.12: "too few arguments to function herr_t H5Ovisit3"

I have armadillo-9.880.1- and hdf5 1.12.0. I can trigger the error with this simple example file:

#include <hdf5.h>
#include <armadillo>

int main() { return 0; }

Compiled with gcc-10.1.0:

$ g++ -DARMA_DONT_USE_WRAPPER demo.cpp
In file included from /usr/include/armadillo:561,
                 from demo.cpp:2:
/usr/include/armadillo_bits/hdf5_misc.hpp: In function ‘hid_t arma::hdf5_misc::search_hdf5_file(const std::vector<std::__cxx11::basic_string<char> >&, hid_t, int, bool)’:
/usr/include/armadillo_bits/hdf5_misc.hpp:488:119: error: too few arguments to function ‘herr_t H5Ovisit3(hid_t, H5_index_t, H5_iter_order_t, H5O_iterate2_t, void*, unsigned int)’
  488 | EX_NAME, H5_ITER_NATIVE, hdf5_search_callback, void_ptr(&search_info));
      |                                                                      ^

In file included from /usr/include/H5Apublic.h:22,
                 from /usr/include/hdf5.h:23,
                 from demo.cpp:1:
/usr/include/H5Opublic.h:211:15: note: declared here
  211 | H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
      |               ^~~~~~~~~

The error goes away if I don't use -DARMA_DONT_USE_WRAPPER. The error also goes away when switching the order of the includes in the file, i.e., including armadillo before hdf5 gets rid of the error.

Since H5Ovisit3 was added in hdf5-1.12, another way I found to bypass the error is to force hdf5 to use 1.10 API by defining H5_USE_110_API.

Assignee Loading
Time tracking Loading