Results 1 to 2 of 2

Thread: Hello Qt!

  1. #1
    Join Date
    Mar 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Hello Qt!

    yes, my problem lies at the hello world example, can't get any noobier, i am using ubunutu 8, and have downloaded the Qt Creator IDE and things work fine, it's just that i can't seem to make/run anything from terminal, so i downloaded the binaries, extracted and make installed, like it says in the documentation, added to the $PATH the /bin folder, and the /lib, but still nothing, the code i use is standard Hello World example from the qt site.

    what i do is
    qmake -project
    qmake
    make

    then it produces this error
    Makefile:194: warning: overriding commands for target `hello.o'
    Makefile:188: warning: ignoring old commands for target `hello.o'
    gcc -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.5.0/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.5.0/include/QtCore -I/usr/local/Trolltech/Qt-4.5.0/include/QtGui -I/usr/local/Trolltech/Qt-4.5.0/include -I. -I. -I. -o hello.o linux_learning/Programming/hello.c
    linux_learning/Programming/hello.c: In function ‘main’:
    linux_learning/Programming/hello.c:6: warning: implicit declaration of function ‘exit’
    linux_learning/Programming/hello.c:6: warning: incompatible implicit declaration of built-in function ‘exit’
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.5.0/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.5.0/include/QtCore -I/usr/local/Trolltech/Qt-4.5.0/include/QtGui -I/usr/local/Trolltech/Qt-4.5.0/include -I. -I. -I. -o main.o linux_learning/main.cpp
    g++ -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/Qt-4.5.0/lib -o Door hello.o main.o hello.o -L/usr/local/Trolltech/Qt-4.5.0/lib -lQtGui -L/usr/local/Trolltech/Qt-4.5.0/lib -L/usr/X11R6/lib -pthread -lpng -lfreetype -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
    hello.o: In function `main':
    hello.c.text+0x0): multiple definition of `main'
    hello.o:hello.c.text+0x0): first defined here
    collect2: ld returned 1 exit status
    make: *** [Door] Error 1


    i've recently migrated from windows, and i need to know how to do things with terminal.

    Thanks for you help.

  2. #2
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    229
    Thanks
    2
    Thanked 29 Times in 28 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Hello Qt!

    The linker tells you with "multiple definition of `main'" that you have at least two main() functions.
    But only one is allowed in a program.

    So find the second main() and delete it.
    Last edited by Boron; 8th March 2009 at 14:51.

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.