- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
只要我包含文件qcustomplot.h
,就会出现大量错误。我似乎无法解决这个问题,尤其是因为它在 Windows 和 Mac 上都运行良好。也许有人遇到过同样的问题。
以下是出现的错误消息:
In file included from ../maitime/linux_x11.h:9:0,
from ../maitime/recognize.h:20,
from ../maitime/mainwindow.h:6,
from ../maitime/main.cpp:2:
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:64:9: error: expected identifier before numeric constant
None = 0x0000, // obsolete
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:64:9: error: expected '}' before numeric constant
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:64:9: error: expected unqualified-id before numeric constant
In file included from ../../../Qt/5.5/gcc_64/include/QtCore/qglobal.h:1102:0,
from ../../../Qt/5.5/gcc_64/include/QtCore/qcoreapplication.h:37,
from ../../../Qt/5.5/gcc_64/include/QtWidgets/qapplication.h:37,
from ../../../Qt/5.5/gcc_64/include/QtWidgets/QApplication:1,
from ../maitime/main.cpp:1:
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:74:41: error: 'PrintDialogOption' was not declared in this scope
Q_DECLARE_FLAGS(PrintDialogOptions, PrintDialogOption)
^
../../../Qt/5.5/gcc_64/include/QtCore/qflags.h:156:16: note: in definition of macro 'Q_DECLARE_FLAGS'
typedef QFlags<Enum> Flags;
^
../../../Qt/5.5/gcc_64/include/QtCore/qflags.h:156:20: error: template argument 1 is invalid
typedef QFlags<Enum> Flags;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:74:5: note: in expansion of macro 'Q_DECLARE_FLAGS'
Q_DECLARE_FLAGS(PrintDialogOptions, PrintDialogOption)
^
In file included from ../../../Qt/5.5/gcc_64/include/QtPrintSupport/QtPrintSupport:4:0,
from ../maitime/qcustomplot/qcustomplot.h:54,
from ../maitime/mainwindow.h:11,
from ../maitime/main.cpp:2:
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:77:44: error: expected ')' before '*' token
explicit QAbstractPrintDialog(QPrinter *printer, QWidget *parent = 0);
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:78:28: error: expected constructor, destructor, or type conversion before ';' token
~QAbstractPrintDialog();
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:80:22: error: 'virtual' outside class declaration
virtual int exec() = 0;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:80:26: error: function 'int exec()' is initialized like a variable
virtual int exec() = 0;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:83:27: error: variable or field 'addEnabledOption' declared void
void addEnabledOption(PrintDialogOption option);
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:83:27: error: 'PrintDialogOption' was not declared in this scope
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:85:41: error: non-member function 'PrintDialogOptions enabledOptions()' cannot have cv-qualifier
PrintDialogOptions enabledOptions() const;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:86:26: error: 'PrintDialogOption' was not declared in this scope
bool isOptionEnabled(PrintDialogOption option) const;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:86:52: error: expected ',' or ';' before 'const'
bool isOptionEnabled(PrintDialogOption option) const;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:90:24: error: variable or field 'setPrintRange' declared void
void setPrintRange(PrintRange range);
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:90:24: error: 'PrintRange' was not declared in this scope
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:91:5: error: 'PrintRange' does not name a type
PrintRange printRange() const;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:94:19: error: non-member function 'int minPage()' cannot have cv-qualifier
int minPage() const;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:95:19: error: non-member function 'int maxPage()' cannot have cv-qualifier
int maxPage() const;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:98:20: error: non-member function 'int fromPage()' cannot have cv-qualifier
int fromPage() const;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:99:18: error: non-member function 'int toPage()' cannot have cv-qualifier
int toPage() const;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:101:25: error: non-member function 'QPrinter* printer()' cannot have cv-qualifier
QPrinter *printer() const;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:103:1: error: expected unqualified-id before 'protected'
protected:
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:106:1: error: expected unqualified-id before 'private'
private:
^
In file included from ../../../Qt/5.5/gcc_64/include/QtCore/qcoreapplication.h:37:0,
from ../../../Qt/5.5/gcc_64/include/QtWidgets/qapplication.h:37,
from ../../../Qt/5.5/gcc_64/include/QtWidgets/QApplication:1,
from ../maitime/main.cpp:1:
../../../Qt/5.5/gcc_64/include/QtCore/qglobal.h:1043:35: error: 'QAbstractPrintDialog& operator=(const QAbstractPrintDialog&)' must be a nonstatic member function
Class &operator=(const Class &) Q_DECL_EQ_DELETE;
^
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:107:5: note: in expansion of macro 'Q_DISABLE_COPY'
Q_DISABLE_COPY(QAbstractPrintDialog)
^
In file included from ../../../Qt/5.5/gcc_64/include/QtPrintSupport/QtPrintSupport:4:0,
from ../maitime/qcustomplot/qcustomplot.h:54,
from ../maitime/mainwindow.h:11,
from ../maitime/main.cpp:2:
../../../Qt/5.5/gcc_64/include/QtPrintSupport/qabstractprintdialog.h:110:1: error: expected declaration before '}' token
};
^
这是我的.pro:
#-------------------------------------------------
#
# Project created by QtCreator 2012-05-09T21:19:57
#
#-------------------------------------------------
QT += core gui \
printsupport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = maiTime
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
applicationdata.cpp \
visualize.cpp \
windowinfo.cpp \
record.cpp \
recognize.cpp \
restrict.cpp \
whitelist_dialog.cpp \
settings.cpp \
qcustomplot/qcustomplot.cpp
HEADERS += mainwindow.h \
windowinfo.h \
applicationdata.h \
visualize.h \
record.h \
recognize.h \
restrict.h \
whitelist_dialog.h \
settings.h \
qcustomplot/qcustomplot.h
macx {
OBJECTIVE_SOURCES += mac.mm
HEADERS += mac.h
LIBS += -framework Cocoa
}
unix:!macx {
HEADERS += linux_x11.h
SOURCES += linux_x11.cpp
LIBS += -lX11
CONFIG += c++11
}
win32 {
SOURCES += win.cpp
HEADERS += win.h
LIBS += -lpsapi
}
FORMS += \
mainwindow.ui \
whitelist_dialog.ui
RESOURCES += \
resources.qrc
ICON = lemon.icns
创建全新的应用程序时,不会出现这些错误。这是我们如何包含文件的方式:#include "qcustomplot/qcustomplot.h"
(是的,路径是正确的)
我们正在运行 Qt 5.5。
提前致谢!
最佳答案
感谢您的帮助,我们找到了错误。事实上,它只是需要重新排序的一行。这是我们的 mainwindow.h:
#include <QMainWindow>
#include <QtWidgets>
#include "recognize.h"
#include "record.h"
#include "restrict.h"
#include "visualize.h"
#include "whitelist_dialog.h"
#include "qcustomplot/qcustomplot.h"
这是我们的 recognize.h:
#include <QtCore>
#include <QString>
#include <QWindow>
#include <QDebug>
#include <QDateTime>
#include <QCoreApplication>
#include "windowinfo.h"
#include "linux_x11.h"
这导致错误。我们所要做的就是重新排序我们 recognize.h 的包含,直到最后,就在
#include qcustomplot/qcustomplot.h
感谢您的帮助!永远记住,在 linux 下 includes
和 qcustomplot 的顺序很重要!
此外:讨论相同问题的链接: http://forum.qtfr.org/discussion/4438/qt4-linux-inclusion-de-xlib-h-qui-pose-probleme (不幸的是法语)
关于c++ - QCustomPlot include 在 Linux/Ubuntu 上导致奇怪的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34070802/
这个问题已经有答案了: 已关闭12 年前。 Possible Duplicates: what is the difference between #include and #include “fi
我想使用 #include 指令,其文件名作为外部定义的宏传递。 例如 #include #FILE".h" 其中 FILE 将被定义为字符串 MyFile(不带引号),结果为 #include "M
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我想在当前目录及其子目录下的每个 .m 文件中查找所有出现 ncread 的情况。我使用以下命令: grep -R --include="\.m" ncread . 但是该命令没有返回任何内容。 gr
有时我会遇到这样的情况,我发现我需要为大型第三方文件制作一个#include,这样我才能使用一个函数或一个小类,这让我感到内疚,因为我知道这已经消失了增加我的编译时间,因为当我只想要一个功能时它会编译
这个问题在这里已经有了答案: 关闭13年前. Possible Duplicate: what is the difference between #include and #include “fi
我正在尝试通过应用程序加载器提交应用程序。我收到这个错误。但我已经检查了build设置,所有三种架构都包含在有效架构设置中。 最佳答案 断开任何设备,只保留“iOS 设备”中的选项并将其存档。 关于i
Please check this demo plunker更好地理解我的问题。 在我的主页上有一个表格。每个表行后面都有一个最初隐藏的空行。单击第一行时,我使用指令在其下方的空行中注入(inject
我正在使用 mkdocs 创建 html 网页和片段扩展以将我的主文档分成小块。我有一个难以理解的错误: 在我制作的文件file1.md中: --8<-- includes/some_rep/frag
include的推荐方式是什么?您项目的所有文件? 我见过很多使用类似结构的例子: include 的有序列表单个顶级文件(定义 Module 的文件,或应用程序中的“主”文件)中的语句。 这似乎也是
我想知道如何使用 fx:include与 JavaFX Scene Builder 结合使用,因此: 想象我有一个 BorderPane (文件 borderpane.fxml)。在中间部分我想放一个
我看到 Fortran 有“调用”和“包含”语句。两者有什么区别? .i 文件类型有什么意义吗? 即: include 'somefile.i' call 'somesubroutine.f' 谢谢!
这很挑剔,可能没有任何实际用途。我只是好奇... 在 C++20 工作草案 (n4861) 中, header 名称定义为: (5.8) header-name: " q-char-
这个问题已经有答案了: 已关闭10 年前。 Possible Duplicate: What is the difference between #include and #include “fil
我有一个非常庞大且臃肿的类,我想将它拆分成单独的文件,但它应该对用户完全透明并且与使用该类的现有项目兼容。 特别是,我有自己的 ImageMatrix 类,它定义了大量的一元函数、大量带有标量的二元函
我是 grep 的新手,在重构 C 和 C++ 文件的过程中,我遇到了替换系统的问题,包括 #include <>与本地包括 #include "" . 有没有一种方法可以将 grep 与任何替代工具
我正在制作一个 Spring MVC web 项目,我必须有一个常量 header 。 我的基本要求是“我们希望在所有屏幕上都有一个标题,以显示谁登录了 ProjectA。” 我从这里“What is
在 SWIG 中,“%include”指令与标准 C“#include”有什么区别? 例如,在所有教程中,为什么它们通常看起来像这样: %module my_module %{ #include "M
假设我们有这个头文件: MyClass.hpp #pragma once #include class MyClass { public: MyClass(double); /* .
我已经在一个项目上工作了一段时间,该项目实现了一个使用 C 库的自定义框架。该框架是用 Swift 编写的,我创建了一个模块来向 Swift 公开 C 头文件。该框架是在不同的项目中启动的,然后将该框
我是一名优秀的程序员,十分优秀!