Results 1 to 5 of 5

Thread: Elementary "hello" program doesn't build

  1. #1
    Join Date
    Aug 2010
    Posts
    12
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Elementary "hello" program doesn't build

    I have Qt4.3 installed on my at-work machine, and it's used for our main software development. Our builds run fine.

    Today, wanting to learn more about Qt4, I'm building the very simple "hello world" demo app in Chap. 1 of the Blanchette-Summerfield book. It looks the same as in other books and online tutorials, as far as I can see, except mine is named 'hey' instead of 'hello' (too busy to type longwinded 5-letter names :P).

    But in my case this won't build. I ran 'qmake -project' and have the resulting .pro file in a text editor. Then I run qmake (no args) then make. Sometimes I get this error:

    bash> make
    g++ -c -pipe -Wall -W -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/usr/lib64/qt-3.3/mkspecs/default -I. -I. -I/usr/lib64/qt-3.3/include -o hey.o hey.cpp
    hey.cpp:4:24: error: QApplication: No such file or directory
    hey.cpp:5:18: error: QLabel: No such file or directory
    ... subsequent errors due to no finding Qt's include files...

    but sometimes I get this error:

    bash> make
    g++ -o hey hey.o -L/usr/lib64/qt-3.3/lib -lqt-mt -lXext -lX11 -lm
    hey.o: In function `main':
    /users/dwilson/play/qtblanchette/hey/hey.cpp:10: undefined reference to `QApplication::QApplication(int&, char**, int)'
    hey.o: In function `QString':
    /usr/include/QtCore/qstring.h:376: undefined reference to `QString::fromAscii_helper(char const*, int)'
    ... several more undef refs ...

    What bonehead beginner mistake am I making?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Elementary "hello" program doesn't build

    Looks like you are using qmake from Qt 3.3 and not Qt 4.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Aug 2010
    Posts
    12
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Elementary "hello" program doesn't build

    Both Qt4 and Qt3 are on this machine. Well then, how to tell qmake to use 4 not 3?

  4. #4
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Elementary "hello" program doesn't build

    Quote Originally Posted by DrunkenUFOPilot View Post
    Both Qt4 and Qt3 are on this machine. Well then, how to tell qmake to use 4 not 3?
    try to use qt4-qmake instead of qmake or install the sdk, and run qmake from full path, eg ~/qtsdk/qt/bin/qmake.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Elementary "hello" program doesn't build

    Quote Originally Posted by DrunkenUFOPilot View Post
    Both Qt4 and Qt3 are on this machine. Well then, how to tell qmake to use 4 not 3?
    You don't "tell" qmake to use Qt4. You have two qmake binaries - one for Qt3 and one for Qt4. The proper one can be called qmake-qt4.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    DrunkenUFOPilot (10th March 2011)

Similar Threads

  1. "Cannot run program "C:\Qt\4.3.3\bin\qmake": file not found
    By PeteH in forum Installation and Deployment
    Replies: 1
    Last Post: 7th February 2009, 00:48
  2. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  3. Replies: 3
    Last Post: 28th December 2007, 11:02
  4. Setting QFrame palette in Designer doesn't "stick"
    By Doug Broadwell in forum Qt Tools
    Replies: 1
    Last Post: 9th September 2007, 21:44
  5. Replies: 2
    Last Post: 6th April 2006, 08:21

Tags for this Thread

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.