HDF5 C ++ Qt冲突声明

时间:2018-06-18 10:56:09

标签: c++ qt declaration hdf5

情况:我需要阅读.hdf5文件,并在用Qt创建的界面中以图形方式显示数据。

我做了什么:我创建了一个新项目,除了使用qt向导将hdf5.lib作为外部库添加到hdf5_test.pro以执行此操作之外#include <hdf5.h>

中的{1}}

问题: 在尝试运行代码时,我得到Errormainwindow.h

使用:

  • C ++
  • Qt 5.10.1
  • MinGW 5.3.0 32位for C ++
  • HDF5 1.10.2

我的代码:

&#13;
&#13;
conflicting declaration 'typedef long long ssize_t'
&#13;
&#13;
&#13;

&#13;
&#13;
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <hdf5.h>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
&#13;
&#13;
&#13;

This可能是一个类比问题,但没有答案。

1 个答案:

答案 0 :(得分:0)

这是一个hack,但hdf5.h检查H5_SIZEOF_SSIZE_T是否等于零。所以使用

#define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG_LONG
在包含hdf5.h之前,

可以帮助重新定义类型。