【发布时间】:2018-11-27 04:59:19
【问题描述】:
情况:我需要读取一个.hdf5 文件并在使用Qt 创建的界面中以图形方式显示数据。
我做了什么:我创建了一个新项目,除了将 hdf5.lib 作为外部库添加到 hdf5_test.pro 之外,使用 qt 向导和 #include <hdf5.h> 在mainwindow.h
问题:
尝试运行代码时,我得到了这个Error:conflicting declaration 'typedef long long ssize_t'
使用:
- C++
- Qt 5.10.1
- MinGW 5.3.0 32bit for 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'
This 可能是一个类似的问题,但没有答案。
【问题讨论】:
标签: c++ qt declaration hdf5