我也碰到了相同的问题我的代码是#include <qapplication.h>
#include <qlabel.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel hello("Hello world!");
hello.show();
return app.exec();
}
运行结果是qmake helloworld.cpp
/usr/local/Trolltech/helloworld.cpp:4: Unknown test function: int main
/usr/local/Trolltech/helloworld.cpp:6: Unknown test function: QApplication app
/usr/local/Trolltech/helloworld.cpp:6: Parse Error ('QApplication app(argc, argv);')
/usr/local/Trolltech/helloworld.cpp:6: Unterminated conditional block at end of file