免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2000 | 回复: 3
打印 上一主题 下一主题

[其它] qtdemo的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-04-07 16:27 |只看该作者 |倒序浏览
本帖最后由 kallytin 于 2014-04-07 16:29 编辑

以下是一个简单的程序,共3个文件(main.cpp, qtdemo.cpp, qtdemo.h),详细代码如下:
  1. 1)main.cpp
  2. #include <QApplication>
  3. #include <qtdemo.h>
  4.                                                                                 
  5. int main(int argc, char **argv)
  6. {
  7.         QApplication a(argc, argv);
  8.         Demo *demo = new Demo;
  9.                                                                                 
  10.         demo->setGeometry(300,300,100,100);
  11.         demo->setWindowTitle("Qt Demo");
  12.         demo->show();
  13.                                                                                 
  14.         return a.exec();
  15. }
复制代码
  1. 2)qtdemo.cpp
  2. #include <QLabel>
  3. #include <QVBoxLayout>
  4. #include <QPushButton>
  5. #include "qtdemo.h"
  6.                                                                                 
  7. Demo::Demo()
  8. {
  9.         string = new QLabel(tr("This is a QT Demo!!"));
  10.         string->setFont(QFont("Times",20, QFont::Bold));
  11.         string->setAlignment(Qt::AlignHCenter);
  12.                                                                                 
  13.         button = new QPushButton("Quit");
  14.         button->setFont(QFont("Times",15, QFont::Bold));
  15.                                                                                 
  16.         vlayout = new QVBoxLayout;
  17.         vlayout->addWidget(string);
  18.         vlayout->addWidget(button);
  19.         setLayout(vlayout);
  20.                                                                                 
  21.         connect(button,SINGAL(clicked()),this,SLOT(close()));
  22. }
复制代码
  1. 3)qtdemo.h
  2. #ifndef __QTDEMO__
  3. #define __QTDEMO__
  4.                                                                                 
  5. #include <QWidget>
  6. class QLabel;
  7. class QVBoxLayout;
  8. class QPushButton;
  9.                                                                                 
  10. class Demo:public QWidget
  11. {
  12. public:
  13.         Demo();
  14. private:
  15.         QLabel *string;
  16.         QVBoxLayout *vlayout;
  17.         QPushButton *button;
  18. };
  19.                                                                                 
  20. #endif
复制代码
问题:
执行qtmake -project 以及 qtmake 都成功,但执行 make 时报错,错误提示如下:
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
-DQT_SHARED -I/usr/local/Trolltech/Qt-4.5.3/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.5.3/include/QtCore -I/usr/local/Trolltech/Qt-4.5.3/include/QtGui -I/usr/local/Trolltech/Qt-4.5.3/include -I. -I. -o qtdemo.o qtdemo.cpp
qtdemo.cpp: In constructor `Demo:emo()':
qtdemo.cpp:20: `clicked' undeclared (first use this function)
qtdemo.cpp:20: (Each undeclared identifier is reported only once for each
   function it appears in.)
qtdemo.cpp:20: `SINGAL' undeclared (first use this function)
make: *** [qtdemo.o] Error 1


运行环境:
redhat 9

论坛徽章:
0
2 [报告]
发表于 2014-04-07 16:30 |只看该作者
回复 1# kallytin


  ding  

论坛徽章:
0
3 [报告]
发表于 2014-04-07 16:56 |只看该作者
回复 2# kallytin

有人知道吗?
   

论坛徽章:
0
4 [报告]
发表于 2014-04-08 15:02 |只看该作者
回复 1# kallytin

有人知道吗?
   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP