PDA

View Full Version : Hello Qt!



BlackSword
8th March 2009, 08:31
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.

Boron
8th March 2009, 13:44
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.