Results 1 to 3 of 3

Thread: Setting up qmake to run "Hello World"

  1. #1
    Join Date
    May 2006
    Posts
    2
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Setting up qmake to run "Hello World"

    Hi,

    I have a problem compiling my first "Hello World" program with qmake. I am using QT 3.3.4 with Debian Sarge and gcc 3.3.5. I first compiled the Qt-Tutorial 1 from the Trolltech website by directly calling gcc without any problems:

    Qt Code:
    1. gcc -o qt1 main.cpp -I$QTDIR/include -L$QTDIR/lib -lqt-mt
    To copy to clipboard, switch view to plain text mode 

    Next I wanted to follow the direction from the tutorial and use qmake:

    Qt Code:
    1. qmake -project
    2. qmake
    3. make
    To copy to clipboard, switch view to plain text mode 

    The last call to make gave me a long list of errors:
    Qt Code:
    1. g++ -o qt main.o -L/usr/X11R6/lib -lXext -lX11 -lm
    2. main.o(.text+0x30): In function `main':
    3. : undefined reference to `QApplication::QApplication[in-charge](int&, char**)'
    4. main.o(.text+0x41): In function `main':
    5. : undefined reference to `QString::QString[in-charge](char const*)'
    6. main.o(.text+0x5f): In function `main':
    7. : undefined reference to `QPushButton::QPushButton[in-charge](QString const&, QWidget*, char const*)'
    8. main.o(.text+0x74): In function `main':
    9. : undefined reference to `QString::shared_null'
    10. main.o(.text+0x7e): In function `main':
    11. : undefined reference to `QStringData::deleteSelf()'
    12. main.o(.text+0xa6): In function `main':
    13. : undefined reference to `QPushButton::resize(int, int)'
    14. main.o(.text+0xb2): In function `main':
    15. : undefined reference to `QApplication::setMainWidget(QWidget*)'
    16. main.o(.text+0xba): In function `main':
    17. : undefined reference to `QWidget::show()'
    18. main.o(.text+0xc2): In function `main':
    19. : undefined reference to `QApplication::exec()'
    20. main.o(.text+0xcc): In function `main':
    21. : undefined reference to `QPushButton::~QPushButton [in-charge]()'
    22. main.o(.text+0xd4): In function `main':
    23. : undefined reference to `QApplication::~QApplication [in-charge]()'
    24. ...
    To copy to clipboard, switch view to plain text mode 

    What makes me suspicious is the first line containing a call to gcc, using X11 libraries and not Qt libraries...

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Setting up qmake to run "Hello World"

    Does your project happen to be in a directory named "qt"? Add "TARGET = something" to the .pro file and run "qmake && make".

  3. #3
    Join Date
    May 2006
    Posts
    2
    Qt products
    Qt3
    Platforms
    Unix/X11

    Thumbs up Re: Setting up qmake to run "Hello World"

    Thanks, it works now! The problem was just my stupid directory name...

    Now the needed qt-library is linked correctly against my project.

Similar Threads

  1. linking user space and kernel space programs with qmake
    By zielchri in forum Qt Programming
    Replies: 9
    Last Post: 8th March 2006, 23:11

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.