【问题标题】:Why is HDF5 giving a "too few arguments" error here?为什么 HDF5 在这里给出“参数太少”的错误?
【发布时间】:2020-06-02 17:03:14
【问题描述】:

我正在尝试编译一个使用 HDF5 的包,但失败并显示:

read_hdf5_c.c:537:100: error: too few arguments to function call, expected 8, have 7
      H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, i, &object_info, H5P_DEFAULT);
      ~~~~~~~~~~~~~~~~~~                                                                           ^
/usr/local/include/H5Opublic.h:190:8: note: 'H5Oget_info_by_idx3' declared here
H5_DLL herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name,
       ^

H5Oget_info_by_idx3H50public.h中的定义是

H5_DLL herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name,
    H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo,
    unsigned fields, hid_t lapl_id);

确实有 8 个参数。调用代码只传了7个参数,官方文档也只列出了7个参数:

https://support.hdfgroup.org/HDF5/doc/RM/RM_H5O.html#Object-GetInfoByIdx

缺少的是unsigned fields

我安装的 hdf5 开发库会过时吗?这第 8 个参数被删除了吗?

我正在运行 hdf5 1.12.0

【问题讨论】:

    标签: compiler-errors compilation linker hdf5


    【解决方案1】:

    似乎从 hdf5 1.12.0 开始,当他们引入 H5Oget_info_by_idx3 并且 API 文档落后时,接口发生了一些变化(参见 changelog)。

    通过将fields 设置为H5O_INFO_BASIC,我可以让它在我的项目中编译(更重要的是还可以运行)。如果您需要的某些字段未包含在对象信息结构中,还有H5O_INFO_ALL 可能会起到作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多