• 7389阅读
  • 3回复

简单的"调用退出"命令,为什么会出现这样的错误! [复制链接]

上一主题 下一主题
离线itqpqp
 
只看楼主 正序阅读 楼主  发表于: 2006-04-01
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重新编辑 ]
离线itqpqp
只看该作者 3楼 发表于: 2006-04-03
恩 呵呵^_^
离线sky_hao

只看该作者 2楼 发表于: 2006-04-03
以后这样的问题不要再犯:)
离线itqpqp
只看该作者 1楼 发表于: 2006-04-02
问题已解决!
11行setFont
12行SIGNAL,SLOT即可!
快速回复
限100 字节
 
上一个 下一个