Makefile doesnot work
-
I installed qt through tarball.
qt1.cpp in qt folder[code]
#include <qapplication.h>
#include <qlabel.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!", 0);
app.setMainWidget(label);
label->show();
return app.exec();
}
[/code]while making the executable file
[code]
utkarsh@utkarsh-laptop:~/programming/qt$ qmake qt.pro
utkarsh@utkarsh-laptop:~/programming/qt$ make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o q1.o q1.cpp
q1.cpp:1: fatal error: qapplication.h: No such file or directory
compilation terminated.
make: *** [q1.o] Error 1
utkarsh@utkarsh-laptop:~/programming/qt$
[/code]I am following the book - C++ gui programming with QT3 by Jasmin Blanchette
I instlled QT 4.4.3 tarball -
@#include <QApplication>
#include <QLabel>int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!");
label->show();
return app.exec();
}@Try with this. Qt4 is not Qt3 also it's Qt(cute) not QT ;-)
-
thnx for your support
after making the above changes I m
getting the following results[code]
utkarsh@utkarsh-laptop:~/programming/qt$ qmake qt.pro
utkarsh@utkarsh-laptop:~/programming/qt$ make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o q1.o q1.cpp
q1.cpp:1: fatal error: QApplication: No such file or directory
compilation terminated.
make: *** [q1.o] Error 1
[/code] -
Can you take a look at the contents of /usr/include/qt4/QtGui/ and verify that QApplication is in there?
-
There is no such qt4 directory in /usr/include
Does that mean that QT4 is not installed properly?
what I did was unzipped the tar archive into /usr/local
./configure
make
and set the appropriate path -
Right, you didn't install Qt where it is looking for it. When you say "set the appropriate path" what exactly did you do? In general when installing software on Linux (I assume this is something along those lines), you would:
@./configure --prefix=/path/where/you/want/it
make
make install@
I'm not sure how Qt's installation scheme differs from the norm, but you might try that. -
I followed all the instruction given in the install manual
ftp://ftp.trolltech.com/qt/source/INSTALL
I set the path as$export PATH=/usr/local/Trolltech/Qt-4.3.3/bin:$PATH
-
OK, PATH isn't your issue here, that's just telling your system where the binaries are. But it looks to me like Qt is installed in "/usr/local/Trolltech/Qt-4.3.3/" and not "/usr/" : so you need to change your project file to look in the right place.
-
Please note that Qt 4.3.3 is very outdated. Current release is 4.8.0 from yesterday.