Qt使用QCustomPlot报错时可以尝试下面的方法
cmake
在CMakeLists.txt中添加
find_package(Qt6 REQUIRED COMPONENTS PrintSupport)
qmake
在.pro下添加
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
版本问题的报错的解决补丁
在qcustomplot.h文件中将下面的代码注释
大概在第160行左右
//#ifndef Q_MOC_RUN
namespace QCP {
Q_NAMESPACE
//#else
//class QCP { // when in moc-run, make it look like a class, so we get Q_GADGET, Q_ENUMS/Q_FLAGS features in namespace
// Q_GADGET
// Q_ENUMS(ExportPen)
// Q_ENUMS(ResolutionUnit)
// Q_ENUMS(SignDomain)
// Q_ENUMS(MarginSide)
// Q_FLAGS(MarginSides)
// Q_ENUMS(AntialiasedElement)
// Q_FLAGS(AntialiasedElements)
// Q_ENUMS(PlottingHint)
// Q_FLAGS(PlottingHints)
// Q_ENUMS(Interaction)
// Q_FLAGS(Interactions)
// Q_ENUMS(SelectionRectMode)
// Q_ENUMS(SelectionType)
//public:
//#endif