Zuerst funktioniert alles wenn ich:
mkdir first
main.cpp mit dem Inhalt erstelle:
Code: Alles auswählen
#include <QApplication>
int main( int argc, char *argv[] )
{
QApplication app( argc, argv );
return app.exec();
}
qmake
make
./main.o
erhalte ich keine Fehlermeldungen.
Sobald ich den Inhalt so ändere:
Code: Alles auswählen
#include <QApplication>
#include <QLabel>
int main( int argc, char *argv[] )
{
QApplication app( argc, argv );
QLabel label( "<h1>Hallo Welt!</h1>" );
label.show();
return app.exec();
}
qmake
make
ausführe bekomme ich diese Fehlermeldung.
Code: Alles auswählen
make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -o main.o main.cpp
main.cpp:1:1: Fehler: »lude« bezeichnet keinen Typ
main.cpp: In Funktion »int main(int, char**)«:
main.cpp:6:25: Fehler: Variable »QApplication app« hat Initialisierung, aber unvollständigen Typ
make: *** [main.o] Fehler 1
vrcmr@vrcmr-ThinkPad-T61:~/qt/first$
In der Grafischen Oberfläche funktioniert alles soweit. Auch wenn ein Fehler angezeigt wird.