QApplication: no such file or directory
Hi,
I am working through a Qt tutrorial ( http://doc.trolltech.com/4.0/tutorial-t1.html ) and if I try to compile this source with "make" I get the error "QApplication: no such file or directory". Any idea what is wrong? (Okay the tutorial is for Qt4 and I have Qt3, but does it make a difference for a "Hello World" program?).
I am using Linux, QTDIR is set to /usr/lib/qt3 and I have a file /usr/lib/qt3/include/qapplication.h.
A second question in the same area: If I follow the Qt book ( http://doc.trolltech.com/4.0/how-to-learn-qt.html - see link in the first line of the text), they use #include <qapplication.h> which works on my computer. I thought one shouldn't use the <xxx.h> for includes anymore. Any opinion on that? Which tutorial is the more recent one?
Regards,
Jochen
Re: QApplication: no such file or directory
Quote:
I thought one shouldn't use the <xxx.h> for includes anymore.
True for Qt 4.
I believe you are still using Qt 3 which means you still need to use
# include<xxxx.h>
Re: QApplication: no such file or directory
In general you can't compile Qt3 apps with Qt4 and Qt4 apps with Qt3. The first can only be accomplished by following the Porting to Qt4 guide.
Re: QApplication: no such file or directory
Quote:
Originally Posted by jochen_r
Any idea what is wrong? (Okay the tutorial is for Qt4 and I have Qt3, but does it make a difference for a "Hello World" program?).
Apparently there is a big difference even in a "Hello world" program :(.
I mean I also tried to start learning Qt4.0 using the famous official Qt book, C++ GUI Programming with Qt 3 (ISBN 0-13-124072-2), but from the first program in the book (hello world) i received compilation errors. The book is still great because besides the program examples (which i am sure can be easily modified to work in 4.0 also) it gives you great explanation of all related Qt concepts (slots, signals, etc...).
I am also a newbie to Qt and for now I sticked with the great Qt documentation (assistant) and so far so good. Actually not very far :D but still good :))
Re: QApplication: no such file or directory
I started by getting missing file errors and such like.
If you are using Linux and these commands are available on your
machine you can try:
apt-cache search qt
then, for all the stuff which sounds related to what you want, you do
apt-get install <name of the application>
You have to be root and to have write permission in /usr
Mariane
PS If you have a Debian Sarge you will still miss one file, with an
unpronouncable name. I've forgotten which one it was, if you have a Debian
Sarge I'll send you the file if you want. Just reming me of its name :)
Re: QApplication: no such file or directory
Quote:
Originally Posted by jochen_r
I am coding using QT4, but I had something similar happen to me. I found out that it was because I didn't have
in my project file, hap2006.pro. That may not be your solution, but it worked for me.
Quote:
Originally Posted by jochen_r
A second question in the same area: If I follow the Qt book (
http://doc.trolltech.com/4.0/how-to-learn-qt.html - see link in the first line of the text), they use #include <qapplication.h> which works on my computer. I thought one shouldn't use the <xxx.h> for includes anymore. Any opinion on that? Which tutorial is the more recent one?
Regards,
Jochen
I also ran into that TODAY!, while trying to edit and compile my hap2006 project in Code::Blocks with the MinGW compiler, as an experiment. I found out that some libraries required the ".h" extension, and some did not.
For example, here are the #includes in my homestead.cpp file after I got it to compile using Code::Blocks and the MinGW compiler:
Code:
#include <Qt>
#include <QKeyEvent>
#include <QString.h>
#include <QStringList.h>
#include <QMessageBox.h>
#include <QDate>
#include <QSqlQueryModel.h>
#include <QSqlError.h>
#include <QSqlRecord.h>
#include <QSqlField.h>
#include <QAbstractItemView.h>
#include <QModelIndex>
#include <QHeaderView>
#include <QFile.h>
#include <QDir.h>
#include <QProcess.h>
#include <QDialog.h>
#include <QPrintDialog.h>
#include <QPrinter.h>
#include <QInputDialog.h>
#include <math.h>
#include <QValidator.h>
#include <QIntValidator>
#include <QPalette.h>
#include <QTextEdit.h>
#include <QTextDocument.h>
I just did trial and error on the include statements using the error msgs spit out by the compiler. "Qt" and "QDate" gave "can't find..." messages IF I added the ".h" extension. The rest failed if I DIDN'T have the ".h" extension.:eek:
Re: QApplication: no such file or directory
I remember that in Code::Blocks the included dirs paths were wrong when using the provided qt template (but I can't quite remember which version). If you created your makefile with qmake then the above mixup won't happen (qmake always knows what to include :)).
Re: QApplication: no such file or directory
the CONFIG += qt worked for me, thanks a lot!
Re: QApplication: no such file or directory
For anyone else with this problem...
I'm running Ubuntu (Kubuntu), and had to switch from 'qmake' to 'qmake-qt4' - it seems the default in Ubuntu is Qt3's qmake.
Hope this helps someone.
Re: QApplication: no such file or directory
Quote:
Originally Posted by
bmn
For anyone else with this problem...
I'm running Ubuntu (Kubuntu), and had to switch from 'qmake' to 'qmake-qt4' - it seems the default in Ubuntu is Qt3's qmake.
Hope this helps someone.
yepp it indeed helped me :)
thanx! :)
Re: QApplication: no such file or directory
me too, I was looking for the answer for quite a while, thank you :p
actually though, typing 'qmake-qt4' solves it for me on linux, and now I'm looking for the answer for the same problem on windows 2000. Seems logical the same problem will need a similar answer but the windows 2000 command line rejects all but 'qmake' so I don't know... maybe it's...
Re: QApplication: no such file or directory
You just have to make sure that you execute the qmake of according Qt installation. In case you have multiple Qt installations, you either use the Qt Command Prompt of the according installation or you modify PATH environment by hand and add path to Qt 4's qmake as first path (or at least before Qt 3's path). Alternatively you can pass a full path to the qmake executable when launching it but that's not very convenient, of course.
Re: QApplication: no such file or directory
ok sorry.. er.. My windows 2000 machine uses 'mingw32-make' to create the .exe files to be found in the 'release' or 'debug' folder
:o
Re: QApplication: no such file or directory
Quote:
Originally Posted by
rjburk
me too, I was looking for the answer for quite a while, thank you :p
actually though, typing 'qmake-qt4' solves it for me on linux, and now I'm looking for the answer for the same problem on windows 2000. Seems logical the same problem will need a similar answer but the windows 2000 command line rejects all but 'qmake' so I don't know... maybe it's...
"qmake-qt4" works for me. Thanks a lot!