| 
 | 
 
刚上路就碰钉子。 
一个 "Hello World!" 总是编译失败。。希望大家帮助    
我用的是 WinXP   MinGW   QT4 
 
[code:1]#include <QtGui/QtGui> 
 
int main(int argc, char *argv[]){ 
 
    QApplication app(argc, argv); 
     
    QPushButton hello("Hello world!", 0); 
    hello.resize(100, 30); 
     
    app.setMainWidget(&hello); 
    hello.show(); 
    return app.exec(); 
}[/code:1] 
 
编译出错。。 
 
E:\QT-MAKE>mingw32-make 
mingw32-make -f Makefile.Release 
mingw32-make[1]: Entering directory `E:/QT-MAKE' 
g++ -c -O2 -O2 -frtti -fexceptions -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_D 
LL -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_GUI_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN 
 -I"D:/Qt/4.0.0/include/QtGui" -I"D:/Qt/4.0.0/include/QtCore" -I"D:/Qt/4.0.0/inc 
lude" -I"." -I"D:/Qt/4.0.0/include/ActiveQt" -I"release" -I"." -I"D:\Qt\4.0.0\mk 
specs\win32-g++" -o release\main.o main.cpp 
main.cpp: In function `int qMain(int, char**)': 
main.cpp:10: error: 'class QApplication' has no member named 'setMainWidget' 
mingw32-make[1]: *** [release\main.o] Error 1 
mingw32-make[1]: Leaving directory `E:/QT-MAKE' 
mingw32-make: *** [release] Error 2 |   
 
 
 
 |