Results 1 to 5 of 5

Thread: QApplication: No such file or directory

  1. #1
    Join Date
    May 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QApplication: No such file or directory

    Hey,

    im just starting to learn about Qt so i bought the book "C++ GUI PROGRAMMING WITH Qt 4" and followed all the instructions as far as installing Qt 4.1.1 and everything went through fine, or so i thought. When i went to the first example things kinda went wrong...

    typing qmake -project and qmake hello.pro to create a Makefile for a hello.cpp file went fine as well, but when i type make i get:

    hello.cpp:1:24: error: QApplication: No such file or directory
    hello.cpp:2:18: error: QLabel: No such file or directory


    as well several other errors because those files could not found.

    the code im trying to compile is:

    Qt Code:
    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. }
    To copy to clipboard, switch view to plain text mode 

    i am also pretty sure that i have qt4 in my path, i added the lines:
    PATH=/usr/local/Trolltech/Qt-4.1.1/bin:$PATH
    export PATH

    to my .profile file in my home dir.

    if anyone has any ideas as to what could be wrong please let me know, the book said that if i get an error like this its most likely because im using an older version qt, and that i should make sure that i am indeed using qt4, this seems kind of silly to me as i installed qt4.1.1 that came on a cd with the book...

    thanks in advance.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QApplication: No such file or directory

    Could you please paste the output of "qmake -v" and then everything that follows "make" (including all the long compiler commands, errors and such)?
    J-P Nurmi

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QApplication: No such file or directory

    You seem to be missing the Qt include dir path.
    You should add $QTDIR/include to the additional include paths, so the compiler can find them.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QApplication: No such file or directory

    Quote Originally Posted by marcel View Post
    You seem to be missing the Qt include dir path.
    The question is, why does qmake not handle it like it should..? Maybe he is using old qmake after all..
    J-P Nurmi

  5. #5
    Join Date
    May 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QApplication: No such file or directory

    Hey,

    i added the Qt Include dir to my path and it seems to be working great now. Thanks so much. oh and i dont know if really matters anymore, when i type qmake -v i get:
    QMake version: 2.00a
    Using Qt version 4.1.1 in /usr/local/Trolltech/Qt-4.1.1/lib


    Thanks again for you help guys, i really appreciate it!!

    -Dolinski

Similar Threads

  1. QApplication: no such file or directory
    By jochen_r in forum Newbie
    Replies: 13
    Last Post: 15th November 2008, 21:46
  2. Replies: 4
    Last Post: 13th June 2007, 15:37
  3. errors while installing Qt4.2 in Linux
    By nimmyj in forum Installation and Deployment
    Replies: 11
    Last Post: 13th December 2006, 11:58
  4. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 10:04
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 12:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.