[SOLVED] Error when using qmake to install another program : #include <Qapplication>
-
I am trying to install a Keepassx and to do so I need to use qmake. When I do that it works without a hitch but when i execute the next step which is 'make', i get the following error.
keepassx.h:43:24: fatal error: QApplication: No such file or directory
#include <QApplication>Please keep in mind I am quite new to Linux and even newer to QT.
Also I have on my system version QTcreator 5.3.0 -
Hi and welcome to devnet,
I suspect that Keepassx was written for Qt 4, if so you are missing the
@QT += widgets@
line in the pro file.
-
Ok so i added QT += widgets to the pro file and now I am recieving a new error:
In file included from keepassx.h:80:0:
lib/UrlLabel.h:28:85: error: ‘Qt::WFlags’ has not been declared
LinkLabel(QWidget *parent,const QString& text=QString::null, int x=0, int y=0,Qt::WFlags f=0);just to be sure I am adding to the correct file, i added the QT += widgets to the src.pro file within the keepassx directory. Is that correct or am i supposed to be changing a pro file within QT itself?
Thankyou
I found in the forums that QT::WFlags should be changed to WindowFlags which i did and am now recieving this error:
lib/UrlLabel.h:28:87: error: ‘QT’ has not been declared
LinkLabel(QWidget *parent,const QString& text=QString::null, int x=0, int y=0,QT::WindowFlags f=0);
^
lib/UrlLabel.h:28:103: error: expected ‘,’ or ‘...’ before ‘f’
LinkLabel(QWidget parent,const QString& text=QString::null, int x=0, int y=0,QT::WindowFlags f=0);
^
lib/UrlLabel.h:28:9: error: default argument missing for parameter 5 of ‘LinkLabel::LinkLabel(QWidget, const QString&, int, int, int)’
LinkLabel(QWidget *parent,const QString& text=QString::null, int x=0, int y=0,QT::WindowFlags f=0);
^ -
Hi,
[quote author="YoGsimus" date="1401567021"]just to be sure I am adding to the correct file, i added the QT += widgets to the src.pro file within the keepassx directory. Is that correct or am i supposed to be changing a pro file within QT itself?[/quote]That file is correct.
By the way, it's "Qt", not "QT". "QT" stands for Apple QuickTime.
[quote author="YoGsimus" date="1401567021"]
lib/UrlLabel.h:28:87: error: ‘QT’ has not been declared
LinkLabel(QWidget *parent,const QString& text=QString::null, int x=0, int y=0,QT::WindowFlags f=0);[/quote]C++ is case-sensitive. You need to write "Qt::WindowFlags", not "QT::WindowFlags".Note: KeePassX was written with Qt 4, but you're trying to build with Qt 5. That's why you are getting error messages. You have two options:
Use Qt 4. If you are on Ubuntu, there are instructions at https://www.keepassx.org/dev/projects/keepassx/wiki/Install_instructions
Port the application to Qt 5. Refer to the "porting guide":http://qt-project.org/doc/qt-5/sourcebreaks.html when error messages appear.
I think Option #1 is easier.
-
Ah thankyou very much for your help Qt 4 was the solution!