PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Kein erfolg mit QT



markusschmid
18-07-2001, 16:28
Hi zusammen,
Seit kurzem versuche ich KDE unter QT zu
programmieren. Leider mit wenige erfolg.
Das programm seht wie folgt aus.

#include <qapplication.h>
#include <qlabel.h>

int main (int argc, char **argv)
{
QApplication app (argc, **argv);
QLabel *l = new QLabel ("<H1>Hallo, Welt!</H1>",0);
l -> show();
app.setMainWidget(1);
return app.exec();
}

Die Zeilen habe ich aus einem Buch übernommen.
Kommpileirt habe ich das Programm auf folgende drei Arten:
1. ->
g++ -o hello-qt -I$QTDIR/include -lqt hello-qt.cpp
2. ->
gcc -I$QTDIR/include -L$QTDIR/lib -lqt hello-qt.cpp
3. ->
c++ -I$QTDIR/include -L$QTDIR/lib -lqt -o
hello-qt hello-qt.cpp

Bei allen drei versuchen hat er folgende
Fehlermeldungen gebracht.
hello-qt.cpp: In function `int main(int, char**)`:
hello-qt.cpp:6: no matching function for call to `QApplication::QApplication(int &, .....
/usr/lib/qt2/include/qapplication.h:71 candidates are: QApplication::WApplication(int ....
usw.
am schluss bringt er dan noch hello-qt.cpp:9: no matching function for call to `QApplication::setMainWidget (int)`

Die Enviromentvariable habe ich wie folgt gesezt: export QTDIR=/usr/lib/qt2
Ist das so richtig? Auch habe ich gesehen das
er bei lib qt und auch qt2 drin hat kann es sein das er da probleme macht? Ist es möglich
verschiedene QT-Versionen nebeneinander zu haben da ich möglichst bald qt3 noch installieren möchte? Bitte helft mir ich weis
nicht was ich noch machen soll und ich bin
am verzweifeln.
Danke
Markus

jgbauman
19-07-2001, 00:37
** in "QApplication app (argc, **argv);" weg.
und aus 1 (eins) mach l (kleiner Buchstabe L) in "app.setMainWidget(1);" und schon sollte es funktionieren ;-)

markusschmid
19-07-2001, 17:41
Danke es hat geklappt.