Results 1 to 13 of 13

Thread: Problem with Qt 4.3.0

  1. #1
    Join Date
    Jul 2007
    Location
    Italy
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    1

    Default Problem with Qt 4.3.0

    Hello to all , I'm new in Qt . I have a small problem , today I have made the update to Qt 4.3.0 on my Linux box .
    if I try to compile

    Qt Code:
    1. #include <QApplication>
    2. #include <QPushButton>
    3.  
    4. int main(int argc, char *argv[])
    5. {
    6. QApplication app(argc, argv);
    7.  
    8. QPushButton hello("Hello world!");
    9. hello.resize(100, 30);
    10.  
    11. hello.show();
    12. return app.exec();
    13. }
    To copy to clipboard, switch view to plain text mode 

    Then I made .pro file using qmake -project and finally I made make file using qmake . Then it gave the following error :

    Qt Code:
    1. g++ -c -pipe -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o hello.o hello.cpp
    2. hello.cpp:24:25: error: QApplication: Nessun file o directory
    3. hello.cpp:25:24: error: QPushButton: Nessun file o directory
    4. hello.cpp:36:3: warning: no newline at end of file
    5. hello.cpp: In function ‘int main(int, char**)’:
    6. hello.cpp:29: error: ‘QApplication’ was not declared in this scope
    7. hello.cpp:29: error: expected `;' before ‘app’
    8. hello.cpp:31: error: ‘QPushButton’ was not declared in this scope
    9. hello.cpp:31: error: expected `;' before ‘hello’
    10. hello.cpp:32: error: ‘hello’ was not declared in this scope
    11. hello.cpp:35: error: ‘app’ was not declared in this scope
    12. hello.cpp: At global scope:
    13. hello.cpp:27: warning: unused parameter ‘argc’
    14. hello.cpp:27: warning: unused parameter ‘argv’
    15. make: *** [hello.o] Error 1
    To copy to clipboard, switch view to plain text mode 

    I believe that I am an error of the path , you can help me to resolve and set the path on linux machine step to step.

    sorry for my bad English ....

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

    Default Re: Problem with Qt 4.3.0

    g++ -c -pipe -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o hello.o hello.cpp
    Just take a look there. You are using the qt3 includes and make specs. This is not ok.
    You must use the qt 4.3 includes. So find the path where you installed qt 4.3 and use that path.

    Regards

  3. #3
    Join Date
    Jul 2007
    Location
    Italy
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: Problem with Qt 4.3.0

    Sorry but I don't know how set the right path , I tried : export QTDIR=/usr/lib/qt4
    , but nothing seem to change . I have the same problem also on hello world version qt3.

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

    Default Re: Problem with Qt 4.3.0

    Yes, and after you export QTDIR, do:
    Qt Code:
    1. export PATH=$QTDIR/bin:$PATH
    To copy to clipboard, switch view to plain text mode 
    You should really put these in a shell startup script, in your home dir or in /etc, so you won't have to set them each time you compile something.

    Regards

  5. #5
    Join Date
    Jul 2007
    Location
    Italy
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: Problem with Qt 4.3.0

    I had added the two lines to the file .bashrc , but nothing change.
    Nothing seems to change also if I do from shell the lines
    Qt Code:
    1. export QTDIR=/usr/lib/qt4
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. export PATH=$QTDIR/bin:$PATH
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: Problem with Qt 4.3.0

    You must log out, and back in for the changes to take effect( when modifying bashrc)
    type the following in a shell:
    Qt Code:
    1. echo $QTDIR
    To copy to clipboard, switch view to plain text mode 
    and
    Qt Code:
    1. echo $PATH
    To copy to clipboard, switch view to plain text mode 
    See if they are correct.

    Regards

  7. #7
    Join Date
    Jul 2007
    Location
    Italy
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: Problem with Qt 4.3.0

    I have restar the pc , but nothing .
    here what I obtain :

    Qt Code:
    1. Simontux@linux:~$ echo $QTDIR
    2. /usr/lib/qt4
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. Simontux@linux:~$ echo $PATH
    2. /usr/lib/qt4/bin:/lib/qt4//bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
    To copy to clipboard, switch view to plain text mode 

    It semms correct. But if I compile I obtain the same error .

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

    Default Re: Problem with Qt 4.3.0

    Seems a little weird.
    Did you run qmake again after changing the environment variables?

    Obviously this is an environment configuration error, so it should be easy to fix.

    Could you check what versions moc and qmake return ( via the --v parameter )?

    Regards

  9. The following user says thank you to marcel for this useful post:

    Simon.tux (18th July 2007)

  10. #9
    Join Date
    Jul 2007
    Location
    Italy
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: Problem with Qt 4.3.0

    Did you run qmake again after changing the environment variables?
    Yes I do. But nothing .

    Could you check what versions moc and qmake return ( via the --v parameter )?
    Qt Code:
    1. Simontux@linux:~$ moc -v
    2. Qt Meta Object Compiler version 26 (Qt 3.3.7)
    3. Simontux@linux:~$ qmake -v
    4. Qmake version: 1.07a (Qt 3.3.7)
    5. Qmake is free software from Trolltech AS.
    To copy to clipboard, switch view to plain text mode 

    Some day ago I compiled normally with Qt 4.2....

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

    Default Re: Problem with Qt 4.3.0

    But the versions are not correct .
    They still are from Qt3.

    Also, there is a problem with your path variable from the previous post.
    It is not consistent.

    Once you will set the path correctly, it will work.
    Are you sure that in /usr/lib/qt4/bin you have qt4 tools?

    Anyway, that directory should come first in the path to make sure that v4.3 tools will always get called.

    Regards

  12. #11
    Join Date
    Jul 2007
    Location
    Italy
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: Problem with Qt 4.3.0

    Are you sure that in /usr/lib/qt4/bin you have qt4 tools?
    then I have check it and the right directory is /usr/share/qt4/bin .

    now I am in this situation

    Qt Code:
    1. Simontux@linux:~$ echo $QTDIR
    2. /usr/share/qt4/bin
    3. Simontux@linux:~$ echo $PATH
    4. /usr/share/qt4/bin/bin:/lib/qt4//bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
    To copy to clipboard, switch view to plain text mode 

    but the moc and qmake versions are the same before, and if I compile I obtain the same error .

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

    Default Re: Problem with Qt 4.3.0

    Because, again, the path is not correct:
    /usr/share/qt4/bin/bin:/lib/qt4//bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
    There is an extra "/bin".
    You should have:
    QTDIR=/usr/share/qt4
    PATH=
    /usr/share/qt4/bin:/lib/qt4//bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games

    Regards

  14. #13
    Join Date
    Jul 2007
    Location
    Italy
    Posts
    7
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11
    Thanks
    1

    Thumbs up Re: Problem with Qt 4.3.0

    I have corrected the path and now the all function .

    Thank you so much.......

Similar Threads

  1. QGraphicsView scrolling problem with 4.3.0
    By hb in forum Qt Programming
    Replies: 8
    Last Post: 30th August 2007, 23:18
  2. Graphics view display problem.
    By kiranraj in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2007, 08:08
  3. [QMYSQL] connection problem
    By chaos_theory in forum Installation and Deployment
    Replies: 5
    Last Post: 2nd July 2007, 10:52
  4. Qt 4.3.0 clipping problem?
    By macbeth in forum Qt Programming
    Replies: 6
    Last Post: 13th June 2007, 18:56
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

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
  •  
Qt is a trademark of The Qt Company.