标题:简单的"调用退出"命令,为什么会出现这样的错误!
作者:itqpqp
日期:2006-04-01 23:25
内容:
C++源程序如下:
#include
#include
#include
#include
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类的参数应该煤油写错吧^_^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
很郁闷~~~~
#1 [itqpqp 04-02 17:30]
问题已解决!
11行setFont
12行SIGNAL,SLOT即可!
#2 [sky_hao 04-03 09:44]
以后这样的问题不要再犯:)
#3 [itqpqp 04-03 17:40]
恩 呵呵^_^