You are not logged in.
[17:05] benol ~/qt $ qmake -project
[17:06] benol ~/qt $ qmake
[17:06] benol ~/qt $ make
g++ -c -pipe -Wall -W -march=i686 -O2 -pipe -DQT_NO_DEBUG -I/opt/qt/mkspecs/linux-g++ -I. -I. -I/opt/qt/include -o test.o test.cpp
test.cpp:15:2: warning: no newline at end of file
g++ -o qt test.o -L/usr/X11R6/lib -lXext -lX11 -lm
test.o: In function `main':
test.cpp:(.text+0x2a): undefined reference to `QApplication::QApplication(int&, char**)'
test.cpp:(.text+0x3b): undefined reference to `QString::QString(char const*)'
test.cpp:(.text+0x59): undefined reference to `QPushButton::QPushButton(QString const&, QWidget*, char const*)'
test.cpp:(.text+0x6b): undefined reference to `QString::shared_null'
test.cpp:(.text+0x75): undefined reference to `QStringData::deleteSelf()'
test.cpp:(.text+0x8f): undefined reference to `QPushButton::resize(int, int)'
test.cpp:(.text+0x9b): undefined reference to `QApplication::setMainWidget(QWidget*)'
test.cpp:(.text+0xa3): undefined reference to `QWidget::show()'
test.cpp:(.text+0xab): undefined reference to `QApplication::exec()'
test.cpp:(.text+0xb5): undefined reference to `QPushButton::~QPushButton()'
test.cpp:(.text+0xbd): undefined reference to `QApplication::~QApplication()'
test.cpp:(.text+0xdb): undefined reference to `QString::shared_null'
test.cpp:(.text+0xe5): undefined reference to `QStringData::deleteSelf()'
test.cpp:(.text+0xed): undefined reference to `QApplication::~QApplication()'
test.cpp:(.text+0x103): undefined reference to `QPushButton::~QPushButton()'
test.o:(.gnu.linkonce.r._ZTI6QGList[typeinfo for QGList]+0x8): undefined reference to `typeinfo for QPtrCollection'
test.o:(.gnu.linkonce.r._ZTV6QGList[vtable for QGList]+0xc): undefined reference to `QGList::clear()'
test.o:(.gnu.linkonce.r._ZTV6QGList[vtable for QGList]+0x10): undefined reference to `QGList::~QGList()'
test.o:(.gnu.linkonce.r._ZTV6QGList[vtable for QGList]+0x14): undefined reference to `QGList::~QGList()'
test.o:(.gnu.linkonce.r._ZTV6QGList[vtable for QGList]+0x18): undefined reference to `QPtrCollection::newItem(void*)'
test.o:(.gnu.linkonce.r._ZTV6QGList[vtable for QGList]+0x20): undefined reference to `QGList::compareItems(void*, void*)'
test.o:(.gnu.linkonce.r._ZTV6QGList[vtable for QGList]+0x24): undefined reference to `QGList::read(QDataStream&, void*&)'
test.o:(.gnu.linkonce.r._ZTV6QGList[vtable for QGList]+0x28): undefined reference to `QGList::write(QDataStream&, void*) const'
collect2: ld returned 1 exit status
make: *** [qt] Error 1
Do you know what's the problem? Do I miss some kind of "dev" package or is it a bug in qt package?
Offline
What are you trying to compile?? a personal project ?? maybe this topic should be in General Programing forum...
[My Blog] | [My Repo] | [My AUR Packages]
Offline
Yes, it's my program, "hello world" exactly, only to try qt. I didn't notice the "general programming" forum - my bad.
So does anyone develop in Qt on Arch? What is going on?
Offline
Seems like it's failing to link against the qt libraries, probably due to missing -lqt-mt. My guess is that in the Makefile you should have something like
LDFLAGS=-lqt-mt -lXext -lX11 -lm
I'm not sure how qmake handles Makefiles, though.
Offline
few example of qt apps in aur.... take a look boombox, bsc,kmp
you need to use lqt-mt
Offline
I looked in the Makefile and the LFLAGS is empty. How do I make qmake to generate Makefile correct?
Offline
ok to build foo
in the dir foo source you should see foo.pro
qmake foo.pro
make
make install
this should work, if you are trying to learn the use kdevelop as that can automate a lot of tasks.
search the forums there is a link to a tutorial
Offline
Maybe my Qt isn't working, but I'm not stupid. As you can see in my first post I already tried "qmake -project && qmake && make" and make crashes - that's why I'ma asking how to make it work.
As for KDevelop, I'll think about that later, too bad I can't find an empty project option there. But from what I've already tested, qmake and make work from KDevelop :? Now I'm very confused...
Offline
Maybe my Qt isn't working, but I'm not stupid. As you can see in my first post I already tried "qmake -project && qmake && make" and make crashes - that's why I'ma asking how to make it work.
As for KDevelop, I'll think about that later, too bad I can't find an empty project option there. But from what I've already tested, qmake and make work from KDevelop :? Now I'm very confused...
if qmake works there, the you need to check your code
Offline
Benol: Upload your code somewhere and people can try to compile it. If it does not work for us, the problem is your code.
Offline
You have the errors in my first post, make doesn't seem to see Qt. But here you go - it's just the standart Qt tutorial.
[16:37] benol ~/qt $ cat test.cpp
#include <qapplication.h>
#include <qpushbutton.h>
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QPushButton hello( "Hello world!", 0 );
hello.resize( 100, 30 );
a.setMainWidget( &hello );
hello.show();
return a.exec();
}
[16:37] benol ~/qt $
Offline
no problem in compileing here:
[ronald@pressh_box test]$ gedit test.cpp
[ronald@pressh_box test]$ qmake -project
[ronald@pressh_box test]$ qmake
[ronald@pressh_box test]$ make
g++ -c -pipe -Wall -W -march=i686 -O2 -pipe -DQT_NO_DEBUG -DQT_SHARED -DQT_THREAD_SUPPORT -I/opt/qt/mkspecs/linux-g++ -I. -I. -I/opt/qt/include -o test.o test.cpp
g++ -o test test.o -L/opt/qt/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm
[ronald@pressh_box test]$
Offline
It's the official tutorial, so there can't be any problems. The Qt installation is bad and I don't know what is happening
Offline
did you type it in manually or copy and paste as theat can introduce errors.
fifrefox is known for this
Offline
Weird.. it did not work out of the box for me (I'm using qt 3.3.6-2 from [extra]). The problem is that qmake does not generate a working Makefile. I could make the code compile with the following trick: run qmake -project && qmake, then edit Makefile and fix the LIBS = ... line:
LIBS = $(SUBLIBS) -L/usr/X11R6/lib -L/opt/qt/lib -lXext -lX11 -lm -lqt-mt
After that run make and the errors are gone.
Offline
After editing the Makefile it worked. But why the hell does qmake generate unproper Makefile? :?
Offline
I think I'll stick with KDevelop, as it works fine and generates a good Makefile. But it's not the arch way not to know why simple `qmake` isn't working
Offline