C++源程序如下:
#include<qapplication.h>
#include<qpushbutton.h>
#include<qfont.h>
#include<qvbox.h>
int main(int argc, char ** argv)
{
QApplication a(argc,argv);
QVBox box;
box.resize(200,120);
QPushButton quit("Quit",&box);
quit.setfont(QFont("Time",18,QFont::Bold));
QObject::connect(&quit,signal(clicked()),&a,slot(quit()));
a.setMainWidget(&box);
box.show();
return a.exec();
}
错误如下:
a1.cpp: In function `int main(int, char**)':
a1.cpp:11: no matching function for call to `QPushButton::setfont(QFont)'
a1.cpp:12: `clicked' undeclared (first use this function)
a1.cpp:12: (Each undeclared identifier is reported only once for each function
it appears in.)
a1.cpp:12: `signal' undeclared (first use this function)
a1.cpp:12: no match for call to `(QPushButton) ()'
a1.cpp:12: `slot' undeclared (first use this function)
make: *** [.obj/a1.o] Error 1
自我感觉:
四个头文件在/usr/include里面都能找到
QFont类的参数应该煤油写错吧^_^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
很郁闷~~~~
[ 此贴被itqpqp在2006-04-02 17:33重新编辑 ]