繁体   English   中英

HDF5 C ++ Qt冲突声明

[英]HDF5 C++ Qt conflicting declaration

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

我所做的:我创建了一个新的项目在做什么,但加入hdf5.lib作为外部库的hdf5_test.pro使用Qt的向导做这件事和#include <hdf5.h>mainwindow.h

问题:尝试运行代码时,出现此错误conflicting declaration 'typedef long long ssize_t'


使用方法:

  • C ++
  • Qt 5.10.1
  • MinGW 5.3.0 32位(C ++)
  • HDF5 1.10.2

我的代码:

 #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 

 QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = hdf5_test TEMPLATE = app # The following define makes your compiler emit warnings if you use # any feature of Qt which has been marked as deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if you use deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \\ main.cpp \\ mainwindow.cpp HEADERS += \\ mainwindow.h FORMS += \\ mainwindow.ui win32:CONFIG(release, debug|release): LIBS += -L'C:/Program Files/HDF_Group/HDF5/1.10.2/lib/' -lhdf5 else:win32:CONFIG(debug, debug|release): LIBS += -L'C:/Program Files/HDF_Group/HDF5/1.10.2/lib/' -lhdf5d else:unix: LIBS += -L'C:/Program Files/HDF_Group/HDF5/1.10.2/lib/' -lhdf5 INCLUDEPATH += 'C:/Program Files/HDF_Group/HDF5/1.10.2/include' DEPENDPATH += 'C:/Program Files/HDF_Group/HDF5/1.10.2/include' 


可能是一个类似的问题,但是没有答案。

这是一个入侵,但对于hdf5.h检查H5_SIZEOF_SSIZE_T为等于零。 所以用

#define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG_LONG

在包含hdf5.h之前,可以通过不重新定义类型来提供帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM