December 15, 2011

manish411 manish411
Lab Rat
6 posts

makefile doesnot work

 

I installed qt through tarball.
qt1.cpp in qt folder

  1.  #include <qapplication.h>
  2.  #include <qlabel.h>
  3.  int main(int argc, char *argv[])
  4.  {
  5.  QApplication app(argc, argv);
  6.  QLabel *label = new QLabel("Hello Qt!", 0);
  7.  app.setMainWidget(label);
  8.  label->show();
  9. return app.exec();
  10.  }

while making the executable file

  1. utkarsh@utkarsh-laptop:~/programming/qt$ qmake qt.pro
  2. utkarsh@utkarsh-laptop:~/programming/qt$ make
  3. 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
  4. q1.cpp:1: fatal error: qapplication.h: No such file or directory
  5. compilation terminated.
  6. make: *** [q1.o] Error 1
  7. utkarsh@utkarsh-laptop:~/programming/qt$

I am following the book – C++ gui programming with QT3 by Jasmin Blanchette
I instlled QT 4.4.3 tarball

8 replies

December 15, 2011

P4C P4C
Lab Rat
16 posts

  1. #include <QApplication>
  2. #include <QLabel>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.  QApplication app(argc, argv);
  7.  QLabel *label = new QLabel("Hello Qt!");
  8.  label->show();
  9.  return app.exec();
  10. }

Try with this. Qt4 is not Qt3 also it’s Qt(cute) not QT ;-)

December 15, 2011

manish411 manish411
Lab Rat
6 posts

thnx for your support
after making the above changes I m
getting the following results

  1. utkarsh@utkarsh-laptop:~/programming/qt$ qmake qt.pro
  2. utkarsh@utkarsh-laptop:~/programming/qt$ make
  3. 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
  4. q1.cpp:1: fatal error: QApplication: No such file or directory
  5. compilation terminated.
  6. make: *** [q1.o] Error 1

December 15, 2011

Chris H Chris H
Lab Rat
139 posts

Can you take a look at the contents of /usr/include/qt4/QtGui/ and verify that QApplication is in there?

December 15, 2011

manish411 manish411
Lab Rat
6 posts

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

December 15, 2011

Chris H Chris H
Lab Rat
139 posts

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:

  1. ./configure --prefix=/path/where/you/want/it
  2. make
  3. make install

I’m not sure how Qt’s installation scheme differs from the norm, but you might try that.

December 15, 2011

manish411 manish411
Lab Rat
6 posts

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

December 15, 2011

Chris H Chris H
Lab Rat
139 posts

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.

December 17, 2011

Volker Volker
Robot Herder
5428 posts

Please note that Qt 4.3.3 is very outdated. Current release is 4.8.0 from yesterday.

 
  ‹‹ unhandled win32 exception occurred in install.exe      Systray icons don’t show up on target machine Windows XP SP3 ››

You must log in to post a reply. Not a member yet? Register here!