Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/131.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 使用Qt-3D和QCustomPlot_C++_Qt_Qt5_Qcustomplot_Qt3d - Fatal编程技术网

C++ 使用Qt-3D和QCustomPlot

C++ 使用Qt-3D和QCustomPlot,c++,qt,qt5,qcustomplot,qt3d,C++,Qt,Qt5,Qcustomplot,Qt3d,我有一个应用程序,需要同时使用和库。但是,当尝试在项目中使用.pro文件中的“QT+=3dinput”编译QCustomPlot时,引用和类时会出现几个错误 我相信这与Qt3DInput引入的类与QtGui模块中的类同名有关,但我对Qt的内部工作机制不够熟悉,无法理解编译器错误试图告诉我的内容 到底是什么导致了这个问题,我如何解决它?对.pro文件或QCustomPlot库本身的修改都是可以接受的 要演示此问题,请使用以下.pro文件编译QCustomPlot: QT += widgets pr

我有一个应用程序,需要同时使用和库。但是,当尝试在项目中使用.pro文件中的“QT+=3dinput”编译QCustomPlot时,引用和类时会出现几个错误

我相信这与Qt3DInput引入的类与QtGui模块中的类同名有关,但我对Qt的内部工作机制不够熟悉,无法理解编译器错误试图告诉我的内容

到底是什么导致了这个问题,我如何解决它?对.pro文件或QCustomPlot库本身的修改都是可以接受的

要演示此问题,请使用以下.pro文件编译QCustomPlot:

QT += widgets printsupport 3dinput
TEMPLATE = lib
SOURCES += qcustomplot.cpp
HEADERS += qcustomplot.h
导致这些错误的原因:

In file included from C:/Qt/5.7/mingw53_32/include/QtCore/qnamespace.h:43:0,
                 from C:/Qt/5.7/mingw53_32/include/QtCore/qobjectdefs.h:48,
                 from C:/Qt/5.7/mingw53_32/include/QtCore/qobject.h:46,
                 from C:/Qt/5.7/mingw53_32/include/QtCore/QObject:1,
                 from debug\../../QCustomPlot/qcustomplot.h:29,
                 from debug\moc_qcustomplot.cpp:9:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h: In instantiation of 'constexpr int qMetaTypeId() [with T = QMouseEvent*]':
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1752:26:   required from 'constexpr int qRegisterMetaType() [with T = QMouseEvent*]'
debug\moc_qcustomplot.cpp:2512:84:   required from here
C:/Qt/5.7/mingw53_32/include/QtCore/qglobal.h:746:47: error: static assertion failed: Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system
 #define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                               ^
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1745:5: note: in expansion of macro 'Q_STATIC_ASSERT_X'
     Q_STATIC_ASSERT_X(QMetaTypeId2<T>::Defined, "Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system");
     ^
In file included from C:/Qt/5.7/mingw53_32/include/QtCore/qobject.h:54:0,
                 from C:/Qt/5.7/mingw53_32/include/QtCore/QObject:1,
                 from debug\../../QCustomPlot/qcustomplot.h:29,
                 from debug\moc_qcustomplot.cpp:9:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h: In instantiation of 'static constexpr int QMetaTypeId2<T>::qt_metatype_id() [with T = QMouseEvent*]':
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1746:43:   required from 'constexpr int qMetaTypeId() [with T = QMouseEvent*]'
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1752:26:   required from 'constexpr int qRegisterMetaType() [with T = QMouseEvent*]'
debug\moc_qcustomplot.cpp:2512:84:   required from here
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1604:96: error: 'qt_metatype_id' is not a member of 'QMetaTypeId<QMouseEvent*>'
     static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
                                                                                                ^
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1604:100: error: body of constexpr function 'static constexpr int QMetaTypeId2<T>::qt_metatype_id() [with T = QMouseEvent*]' not a return-statement
     static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
                                                                                                    ^
In file included from C:/Qt/5.7/mingw53_32/include/QtCore/qnamespace.h:43:0,
                 from C:/Qt/5.7/mingw53_32/include/QtCore/qobjectdefs.h:48,
                 from C:/Qt/5.7/mingw53_32/include/QtCore/qobject.h:46,
                 from C:/Qt/5.7/mingw53_32/include/QtCore/QObject:1,
                 from debug\../../QCustomPlot/qcustomplot.h:29,
                 from debug\moc_qcustomplot.cpp:9:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h: In instantiation of 'constexpr int qMetaTypeId() [with T = QWheelEvent*]':
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1752:26:   required from 'constexpr int qRegisterMetaType() [with T = QWheelEvent*]'
debug\moc_qcustomplot.cpp:2540:84:   required from here
C:/Qt/5.7/mingw53_32/include/QtCore/qglobal.h:746:47: error: static assertion failed: Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system
 #define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                               ^
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1745:5: note: in expansion of macro 'Q_STATIC_ASSERT_X'
     Q_STATIC_ASSERT_X(QMetaTypeId2<T>::Defined, "Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system");
     ^
In file included from C:/Qt/5.7/mingw53_32/include/QtCore/qobject.h:54:0,
                 from C:/Qt/5.7/mingw53_32/include/QtCore/QObject:1,
                 from debug\../../QCustomPlot/qcustomplot.h:29,
                 from debug\moc_qcustomplot.cpp:9:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h: In instantiation of 'static constexpr int QMetaTypeId2<T>::qt_metatype_id() [with T = QWheelEvent*]':
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1746:43:   required from 'constexpr int qMetaTypeId() [with T = QWheelEvent*]'
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1752:26:   required from 'constexpr int qRegisterMetaType() [with T = QWheelEvent*]'
debug\moc_qcustomplot.cpp:2540:84:   required from here
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1604:96: error: 'qt_metatype_id' is not a member of 'QMetaTypeId<QWheelEvent*>'
     static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
                                                                                                ^
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1604:100: error: body of constexpr function 'static constexpr int QMetaTypeId2<T>::qt_metatype_id() [with T = QWheelEvent*]' not a return-statement
     static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
                                                                                                    ^
在C:/Qt/5.7/mingw53_32/include/QtCore/qnamespace.h:43:0中包含的文件中,
从C:/Qt/5.7/mingw53_32/include/QtCore/qobjectdefs.h:48,
从C:/Qt/5.7/mingw53_32/include/QtCore/qobject.h:46,
从C:/Qt/5.7/mingw53_32/include/QtCore/QObject:1,
从调试\../QCustomPlot/QCustomPlot.h:29,
从debug\moc\u qcustomplot.cpp:9:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:在“constexpr int qMetaTypeId()[with T=QMouseEvent*]”的实例化中:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1752:26:从'constexpr int qRegisterMetaType()[带T=QMouseEvent*]中需要
调试\moc\u qcustomplot.cpp:2512:84:此处为必填项
C:/Qt/5.7/mingw53_32/include/QtCore/qglobal.h:746:47:错误:静态断言失败:类型未注册,请使用Q_DECLARE_元类型宏让Qt的元对象系统知道它
#定义Q_STATIC_ASSERT_X(条件,消息)STATIC_ASSERT(bool(条件),消息)
^
C:/Qt/5.7/mingw53\u 32/include/QtCore/qmetatype.h:1745:5:注意:在宏“Q\u STATIC\u ASSERT\u X”的展开中
Q_STATIC_ASSERT_X(QMetaTypeId2::Defined,“类型未注册,请使用Q_DECLARE_元类型宏向Qt的元对象系统公开”);
^
在C:/Qt/5.7/mingw53_32/include/QtCore/qobject.h:54:0中包含的文件中,
从C:/Qt/5.7/mingw53_32/include/QtCore/QObject:1,
从调试\../QCustomPlot/QCustomPlot.h:29,
从debug\moc\u qcustomplot.cpp:9:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:在“static constexpr int QMetaTypeId2::Qt_metatype_id()[with T=QMouseEvent*]的实例化中:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1746:43:在“constexpr int qMetaTypeId()[with T=QMouseEvent*]中是必需的”
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1752:26:从'constexpr int qRegisterMetaType()[带T=QMouseEvent*]中需要
调试\moc\u qcustomplot.cpp:2512:84:此处为必填项
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1604:96:错误:“Qt_元类型_id”不是“QMetaTypeId”的成员
静态内联Q_DECL_CONSTEXPR int qt_元类型_id(){返回QMetaTypeId::qt_元类型_id();}
^
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1604:100:错误:constexpr函数体“static constexpr int QMetaTypeId2::Qt_metatype_id()[with T=QMouseEvent*]”不是返回语句
静态内联Q_DECL_CONSTEXPR int qt_元类型_id(){返回QMetaTypeId::qt_元类型_id();}
^
在C:/Qt/5.7/mingw53_32/include/QtCore/qnamespace.h:43:0中包含的文件中,
从C:/Qt/5.7/mingw53_32/include/QtCore/qobjectdefs.h:48,
从C:/Qt/5.7/mingw53_32/include/QtCore/qobject.h:46,
从C:/Qt/5.7/mingw53_32/include/QtCore/QObject:1,
从调试\../QCustomPlot/QCustomPlot.h:29,
从debug\moc\u qcustomplot.cpp:9:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:在“constexpr int qMetaTypeId()[with T=qwheeleevent*]”的实例化中:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1752:26:从'constexpr int qRegisterMetaType()[带T=qwheeleevent*]中需要
调试\moc_qcustomplot.cpp:2540:84:此处为必填项
C:/Qt/5.7/mingw53_32/include/QtCore/qglobal.h:746:47:错误:静态断言失败:类型未注册,请使用Q_DECLARE_元类型宏让Qt的元对象系统知道它
#定义Q_STATIC_ASSERT_X(条件,消息)STATIC_ASSERT(bool(条件),消息)
^
C:/Qt/5.7/mingw53\u 32/include/QtCore/qmetatype.h:1745:5:注意:在宏“Q\u STATIC\u ASSERT\u X”的展开中
Q_STATIC_ASSERT_X(QMetaTypeId2::Defined,“类型未注册,请使用Q_DECLARE_元类型宏向Qt的元对象系统公开”);
^
在C:/Qt/5.7/mingw53_32/include/QtCore/qobject.h:54:0中包含的文件中,
从C:/Qt/5.7/mingw53_32/include/QtCore/QObject:1,
从调试\../QCustomPlot/QCustomPlot.h:29,
从debug\moc\u qcustomplot.cpp:9:
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:static constexpr int QMetaTypeId2::Qt_metatype_id()
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1746:43:在“constexpr int qMetaTypeId()[with T=qwheeleevent*]中是必需的”
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1752:26:从'constexpr int qRegisterMetaType()[带T=qwheeleevent*]中需要
调试\moc_qcustomplot.cpp:2540:84:此处为必填项
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1604:96:错误:“Qt_元类型_id”不是“QMetaTypeId”的成员
静态内联Q_DECL_CONSTEXPR int qt_元类型_id(){返回QMetaTypeId::qt_元类型_id();}
^
C:/Qt/5.7/mingw53_32/include/QtCore/qmetatype.h:1604:100:错误:constexpr函数的主体“static constexpr”