简体   繁体   English

在Ubuntu上的Qt5应用程序中链接libqxt

[英]Linking libqxt in a Qt5 application on Ubuntu

I have a problem with linking libqxt in a Qt5 application. 我在Qt5应用程序中链接libqxt遇到问题。

I write a code like in example in documentation but I have errors. 我在文档中编写了一个代码,但是我有错误。

QxtGlobalShortcut* shortcut = new QxtGlobalShortcut(this);
connect(shortcut, SIGNAL(activated()), this, SLOT(newScreenshoot()));
shortcut->setShortcut(QKeySequence("Ctrl+Shift+F12"));

I'm using Qt 5.0.1 : 我正在使用Qt 5.0.1

damian@damian-Lenovo-B560:~$ qmake --version
QMake version 3.0
Using Qt version 5.0.1 in /usr/lib/i386-linux-gnu

And latest libqxt-dev from Ubuntu 13.04 repository. 来自Ubuntu 13.04存储库的最新libqxt-dev

I have following linker errors: 我有以下链接器错误:

/home/damian/Dokumenty/Programowanie/QShot/mainwindow.cpp:20: error: undefined reference to `QxtGlobalShortcut::QxtGlobalShortcut(QObject*)'
/home/damian/Dokumenty/Programowanie/QShot/mainwindow.cpp:22: error: undefined reference to `QxtGlobalShortcut::setShortcut(QKeySequence const&)'

I am now facing a similar problem on Ubuntu 13.10 and I have succeeded in compiling my application. 我现在面临着Ubuntu 13.10上的类似问题,我已经成功编译了我的应用程序。 The problem is a SIGSEGV I receive when adding the logger engine 问题是我在添加记录器引擎时收到的SIGSEGV

QxtBasicFileLoggerEngine *dbg  = new QxtBasicFileLoggerEngine("debug.log");

// qxtLog takes ownership of dbg - no need to manage its memory
qxtLog->addLoggerEngine("dbg", dbg);

In order to do this I compiled everything with QT4 from command line (Don't use qmake, which uses by default qt5): 为了做到这一点,我从命令行用QT4编译了所有内容(不要使用qmake,它默认使用qt5):

qmake-qt4 
make

So this seems to be indeed a weird combination of qt5 libs with qt4 libs (libqxt seems to be compiled with/for qt4). 所以这似乎确实是qt5 libs与qt4 libs的奇怪组合(libqxt似乎用/为qt4编译)。 Unfortunately I don't have any other option that to use qt4 in order to compile the project on Ubuntu. 不幸的是,我没有任何其他选择使用qt4来编译Ubuntu上的项目。 I don't know if there's an issue raised at canonical. 我不知道在规范中是否存在问题。

Hope this saves some trouble and eliminates some frustration. 希望这可以省去一些麻烦并消除一些挫败感。 I am surprised to see that almost nobody complains about this problem. 我很惊讶地看到几乎没有人抱怨这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM