Anmelden

Archiv verlassen und diese Seite im Standarddesign anzeigen : qt4 (probleme mit qt4 beispielen )



christophwth
14-09-2005, 18:21
Hi

wenn ich des hellowolrd beispiel aus dem QT4 tutorial zu kompilieren gibt es einen fehler:

mein vorgehen:


/************************************************** **************
**
** Qt tutorial 1
**
************************************************** **************/

#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();
}


qmake -project
qmake
make

( mit export QTDIR=/usr/share/qt4 )



g++ -c -pipe -Wall -W -O2 -DQT_NO_DEBUG -I/usr/share/qt4/mkspecs/default -I. -I. -o t1_main.o t1_main.cpp
t1_main.cpp:30:28: error: QApplication: Datei oder Verzeichnis nicht gefunden
t1_main.cpp:31:27: error: QPushButton: Datei oder Verzeichnis nicht gefunden
t1_main.cpp: In function 'int main(int, char**)':
t1_main.cpp:35: error: 'QApplication' was not declared in this scope
t1_main.cpp:35: error: expected `;' before 'app'
t1_main.cpp:37: error: 'QPushButton' was not declared in this scope
t1_main.cpp:37: error: expected `;' before 'hello'
t1_main.cpp:38: error: 'hello' was not declared in this scope
t1_main.cpp:41: error: 'app' was not declared in this scope
t1_main.cpp: At global scope:
t1_main.cpp:33: warning: unused parameter 'argc'
t1_main.cpp:33: warning: unused parameter 'argv'
make: *** [t1_main.o] Fehler 1


ohne (qt3)


g++ -c -pipe -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o t1_main.o t1_main.cpp
t1_main.cpp:30:28: error: QApplication: Datei oder Verzeichnis nicht gefunden
t1_main.cpp:31:27: error: QPushButton: Datei oder Verzeichnis nicht gefunden
t1_main.cpp: In function 'int main(int, char**)':
t1_main.cpp:35: error: 'QApplication' was not declared in this scope
t1_main.cpp:35: error: expected `;' before 'app'
t1_main.cpp:37: error: 'QPushButton' was not declared in this scope
t1_main.cpp:37: error: expected `;' before 'hello'
t1_main.cpp:38: error: 'hello' was not declared in this scope
t1_main.cpp:41: error: 'app' was not declared in this scope
t1_main.cpp: At global scope:
t1_main.cpp:33: warning: unused parameter 'argc'
t1_main.cpp:33: warning: unused parameter 'argv'
make: *** [t1_main.o] Fehler 1


ich nutze debian sid
installiert ist der gcc in der version Debian 4.0.1-6

nun, meine fragen.
warum wurde das qapplication.h in QApplication geändert ?
warum kann der g++ nichts mit QApplication anfangen ?
fehlt in der sid installation irgendwas ?
installiert sind :
libqt3-mt-dev
libqt4-dev
libqt3-headers

was habe ich übersehen ?
ich bin für jeden hinweis dankbar.

gruss
christoph

anda_skoa
14-09-2005, 18:28
Gibt es in /usr/share/qt4 ein include Verzeichnis und sind da die Headerdateien drinnen?

Hattest du QTDIR beim Aufruf von qmake gesetzt, oder erst nachher?

Ciao,
_

christophwth
14-09-2005, 19:05
Hi

danke für deine antwort : ich hatte QTDIR vorher gesetzt und nachher mit unset gelöscht.
(meine informationen sind, daß QTDIR in qt4 nicht mehr benötigt wird http://lists.trolltech.com/qt4-preview-feedback/2005-07/thread00169-0.html:)

in /usr/include sind dateien vorhanden.
siehe
ls /usr/include/qt4/
Qt Qt3Support QtAssistant QtCore QtDesigner QtGui QtNetwork QtOpenGL QtSql QtXml :


ich habe die Antwort des problems schon gefunden. debian scheint bei qmake einen anderen weg zu gehen. (bei debian gibt es wohl keine datei: corelib/global/qconfig.cpp) ; sondern ein angepaßtes qmake )

/usr/bin/qmake-qt4


make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I. -I. -I. -o t1_main.o t1_main.cpp
g++ -o t1 t1_main.o -L/usr/lib -L/tmp/buildd/qt4-x11-4.0.1/lib -lQtGui -L/usr/X11R6/lib -laudio -lXt -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype -lXext -lX11 -lm -lQtCore -lfontconfig -lz -ldl -lpthread


:)

gruss
christoph