。。。是我自己编程的时候不小心,再加上虚拟机显示比较模糊,我把程序改成这样以后:
#include <qapplication.h>
#include <qpushbutton.h>
int main(int argc,char **argv)
{
QApplication a(argc,argv);
QPushButton Hellobtn("Hello World",0);
Hellobtn.resize(100,20);
a.setMainWidget(&Hellobtn);
Hellobtn.show();
return a.exec();
}
出现的提示改为了:
main.cpp: In function `int main(int, char**)':
main.cpp:10: no matching function for call to `QApplication::setMainWidget(
QPushButton*)'
make: *** [.obj/main.o] Error 1
但是把 a.setMainWidget(&Hellobtn);改成 a.setMainWidget(*Hellobtn);后还是不能编译,出来的提示变成了:
main.cpp: In function `int main(int, char**)':
main.cpp:10: no match for `* QPushButton&' operator
/usr/local/Trolltech/Qt-4.1.0/include/QtCore/qpoint.h:137: candidates are:
const QPoint operator*(const QPoint&, double)
/usr/local/Trolltech/Qt-4.1.0/include/QtCore/qpoint.h:140:
const QPoint operator*(double, const QPoint&)
/usr/local/Trolltech/Qt-4.1.0/include/QtCore/qpoint.h:305:
const QPointF operator*(double, const QPointF&)
/usr/local/Trolltech/Qt-4.1.0/include/QtCore/qpoint.h:300:
const QPointF operator*(const QPointF&, double)
/usr/local/Trolltech/Qt-4.1.0/include/QtCore/qsize.h:145: const
QSize operator*(const QSize&, double)
/usr/local/Trolltech/Qt-4.1.0/include/QtCore/qsize.h:148: const
QSize operator*(double, const QSize&)
/usr/local/Trolltech/Qt-4.1.0/include/QtCore/qsize.h:301: const
QSizeF operator*(const QSizeF&, double)
/usr/local/Trolltech/Qt-4.1.0/include/QtCore/qsize.h:304: const
QSizeF operator*(double, const QSizeF&)
make: *** [.obj/main.o] Error 1
麻烦再帮我看看,谢谢
[ 此贴被ghoulr在2006-04-08 13:28重新编辑 ]