编译器没有看到QX11Info [英] Compiler does not see QX11Info
问题描述
我创建了一个类来设置一些全局快捷方式。
现在,当我编译我的应用程序,我看到许多错误:
I've created a little class to set some global shortcuts. But now, when i compile my app i see many errors:
In file included from ../src/GlobalShortcut/globalshortcut_linux.h:7:0,
from moc_globalshortcut_linux.cpp:9:
../../../QtStable/5.4/gcc_64/include/QtWidgets/qstyleoption.h:117:9: error: expected identifier before numeric constant
None = 0x00,
^
../../../QtStable/5.4/gcc_64/include/QtWidgets/qstyleoption.h:117:9: error: expected '}' before numeric constant
../../../QtStable/5.4/gcc_64/include/QtWidgets/qstyleoption.h:117:9: error: expected unqualified-id before numeric constant
In file included from ../../../QtStable/5.4/gcc_64/include/QtCore/qglobal.h:1085:0,
from ../src/GlobalShortcut/globalshortcut_linux.h:4,
from moc_globalshortcut_linux.cpp:9:
../../../QtStable/5.4/gcc_64/include/QtWidgets/qstyleoption.h:121:36: error: 'FrameFeature' was not declared in this scope
Q_DECLARE_FLAGS(FrameFeatures, FrameFeature)
^
当我评论我的类错误消失了。
这是它: http://pastebin.com/k5qSvqDn
When i commented my class errors are gone. Here is it: http://pastebin.com/k5qSvqDn
好吧,我从QWidget继承类,而不是QMainWindow(我不知道为什么:D),现在我有另一个错误:
Ok, i inherited class from QWidget instead of QMainWindow (i dont know why :D) and now i have another errors:
mainwindow.o: In function `X11ShortCut::addShortCut(QKeySequence, QString)':
globalshortcut_linux.h:30: undefined reference to `QX11Info::display()'
globalshortcut_linux.h:31: undefined reference to `QX11Info::appRootWindow(int)'
globalshortcut_linux.h:31: undefined reference to `QX11Info::display()'
globalshortcut_linux.h:32: undefined reference to `QX11Info::display()'
在我的.pro文件中添加了 LIBS + = -lX11
,它没有帮助。
那么,问题是什么?
推荐答案
检查,但我相信你只是错过添加以下到您的 .pro
文件,如 docs
I have not checked, but I believe you only missed adding the following to your .pro
file, as stated at the docs
QT += gui x11extras
这可能是你可能会丢失一个头文件,但没有错误信息,我觉得有点硬因为我从来没有触摸过X11的东西。
It's likely that that you may be missing a header file, but without the error message, I find it a bit hard to figure it out since I've never touched X11 stuff directly.
希望它有帮助。
这篇关于编译器没有看到QX11Info的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!