You are not logged in.

#1 2006-01-03 12:39:13

pukyxd
Member
Registered: 2004-12-26
Posts: 20
Website

I can't get working QT4

I've installed the qt4 package from the AUR but I can't get working it.

Getting and simple hello world example from the qt page I've changed the PATH adding /opt/qt4/bin at the start and I've changed $QTDIR to /opt/qt4 but I can't compile it, here the log:

[root@pukypc ~]# echo $PATH
/opt/qt4/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/opt/bin:/opt/gnome/bin:/opt/java/jre/bin:/opt/kde/bin:/opt/mozilla/bin:/opt/NX/bin:/opt/qt/bin:/usr/local/unsermake/
[root@pukypc ~]# echo $QTDIR
/opt/qt4
[root@pukypc ~]# qmake -v
QMake version: 2.00a
Using Qt version 4.1.0 in /opt/qt4/lib
[root@pukypc ~]# cat /etc/ld.so.conf
#
# /etc/ld.so.conf
#

/usr/X11R6/lib

# End of file
/opt/qt4/lib
/opt/kde/lib
/opt/qt/lib
/opt/gnome/lib
/opt/mozilla/lib/firefox
/usr/lib/libfakeroot

[root@pukypc ~]# make
g++ -c -pipe -Wall -W -march=i686 -O2 -pipe  -DQT_NO_DEBUG -I/opt/qt4/mkspecs/linux-g++ -I. -I. -I/opt/qt4/include/ -o main.o main.cpp
main.cpp:1:24: error: QApplication: El fitxer o directori no existeix
main.cpp:2:23: error: QPushButton: El fitxer o directori no existeix
main.cpp: In function 'int main(int, char**)':
main.cpp:6: error: 'QApplication' was not declared in this scope
main.cpp:6: error: expected `;' before 'app'
main.cpp:7: error: 'QPushButton' was not declared in this scope
main.cpp:7: error: expected `;' before 'hello'
main.cpp:8: error: 'hello' was not declared in this scope
main.cpp:10: error: 'app' was not declared in this scope
main.cpp:11: error: expected ';' before '}' token
main.cpp: At global scope:
main.cpp:4: avís: unused parameter 'argc'
main.cpp:4: avís: unused parameter 'argv'
make: *** [main.o] Error 1

And here the code:

#include <QApplication>
#include <QPushButton>

int main(int argc, char *argv[])
{
        QApplication app(argc, argv);
        QPushButton hello("Hello world!");
        hello.resize(100, 30);
        hello.show();
        return app.exec();
}

Any idea of what must i change more to can compile?

Offline

#2 2006-01-03 16:48:01

rinzai
Member
From: Sofia || München || Garching
Registered: 2005-03-04
Posts: 21

Re: I can't get working QT4

Just two wild guesses:

1) Shouldn't you run qmake first to buid the project file? OR
2) Shouldn't there be -lqt option in the first command that make executes (the one with g++)?


Being able to read someone else's code is a *good thing*. Not a fundamental right.

Offline

#3 2006-01-03 20:58:13

pukyxd
Member
Registered: 2004-12-26
Posts: 20
Website

Re: I can't get working QT4

Before I've done the qmake -project and qmake command. And adding the -lqt flag doesn't help. Anybody can help me? I want to compile with QT4!!

Offline

#4 2006-01-04 00:37:19

celeron2002
Member
From: Santiago, Chile.
Registered: 2004-02-18
Posts: 150

Re: I can't get working QT4

you have some errors in the code, try it with:

#include <qapplication.h>
#include <qpushbutton.h>

int main(int argc, char *argv[])
{
      QApplication app(argc, argv);
      QPushButton *hello = new QPushButton("Hello world!",0);
        hello->show();
       return app.exec();
                               }

irc.bsd.cl #linux
irc.freenode.org #archlinux-es

Offline

#5 2006-01-04 11:33:41

pukyxd
Member
Registered: 2004-12-26
Posts: 20
Website

Re: I can't get working QT4

But this code is for QT3, not for QT4... See this.

Offline

#6 2006-01-04 13:51:42

shastry
Member
Registered: 2004-08-24
Posts: 45

Re: I can't get working QT4

seriously.. do you guys read the install messages ?

do this as root:

qt-config qt4

then logout and login (recommended) OR do source /etc/profile

now the hello world program:

//begin hello.cc
#include <QApplication>
#include <QPushButton>

int main(int argc, char * argv [])
{
  QApplication app(argc,argv);

  QPushButton hello("Hello world!");
  hello.resize (100,30);

  hello.show();

  return app.exec();
}
//end hello.cc

now run these to compile :

qmake -project
qmake
make

that will compile your program. If that doesnt work, post with error message. The thing is.. in your previous attempt.. you just added stuff to PATH and set QTDIR .. just those 2 variables are not sufficient. look at /etc/profile.d/qt4.sh  to know what you missed out. I recommend using the qt-config (profile changer)

Offline

Board footer

Powered by FluxBB