新浪微博
腾讯微博
会员列表
统计排行
基本信息
到访IP统计
管理团队
管理统计
在线会员
会员排行
版块排行
帖子排行
标签排行
帮助
下拉
用户名
电子邮箱
用户名
密 码
记住登录
登录
找回密码
注册
快捷通道
关闭
您还没有登录,快捷通道只有在登录后才能使用。
立即登录
还没有帐号? 赶紧
注册一个
首页
论坛
Qt下载
作品展
群组
个人中心
捐赠、管理与开发
邮件订阅
帖子
文章
日志
用户
版块
群组
帖子
搜索
QTCN开发网
>
Qt基础编程
>
试着运行QT creator 帮助文件的Tutorial,竟然出错
发帖
回复
返回列表
新帖
5666
阅读
5
回复
[原创]
试着运行QT creator 帮助文件的Tutorial,竟然出错
[复制链接]
上一主题
下一主题
离线
ebony
UID:111470
注册时间
2011-01-21
最后登录
2011-09-09
在线时间
0小时
发帖
4
搜Ta的帖子
精华
0
金钱
40
威望
14
贡献值
0
好评度
4
访问TA的空间
加好友
用道具
新手上路
关闭
个人中心可以申请新版勋章哦
立即申请
知道了
加关注
发消息
只看楼主
倒序阅读
楼主
发表于: 2011-02-01
请帮着看看,到底为错在哪里,看了好久,找不到
错误
啊。
Running build steps for project testTextFinder...
Configuration unchanged, skipping qmake step.
Starting: "C:/Qt/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Qt/zcsTest/testTextFinder-build-desktop'
C:/Qt/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Qt/zcsTest/testTextFinder-build-desktop'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\qt\include\QtCore" -I"..\..\qt\include\QtGui" -I"..\..\qt\include" -I"..\..\qt\include\ActiveQt" -I"debug" -I"." -I"..\testTextFinder" -I"." -I"..\..\qt\mkspecs\win32-g++" -o debug\testtextfinder.o ..\testTextFinder\testtextfinder.cpp
..\testTextFinder\testtextfinder.cpp: In constructor 'testTextFinder::testTextFinder(QWidget*)':
..\testTextFinder\testtextfinder.cpp:11: error: 'loadTextFile' was
not
declared in this scope
..\testTextFinder\testtextfinder.cpp: At global scope:
..\testTextFinder\testtextfinder.cpp:25: error: no 'void testTextFinder::loadTextFile()' member function declared in class 'testTextFinder'
mingw32-make[1]: Leaving directory `C:/Qt/zcsTest/testTextFinder-build-desktop'
mingw32-make: Leaving directory `C:/Qt/zcsTest/testTextFinder-build-desktop'
mingw32-make[1]: *** [debug/testtextfinder.o] Error 1
mingw32-make: *** [debug] Error 2
The process "C:/Qt/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project testTextFinder (target: Desktop)
When executing build step 'Make'
=================================================================================
我仔细查看过,只是将tutorial里的类的名字: TextFinder 改为TestTextFinder
共
条评分
回复
举报
分享到
淘江湖
新浪
QQ微博
QQ空间
开心
人人
豆瓣
网易微博
百度
鲜果
白社会
飞信
离线
ebony
UID:111470
注册时间
2011-01-21
最后登录
2011-09-09
在线时间
0小时
发帖
4
搜Ta的帖子
精华
0
金钱
40
威望
14
贡献值
0
好评度
4
访问TA的空间
加好友
用道具
新手上路
加关注
发消息
只看该作者
1楼
发表于: 2011-02-01
testTextFinder.cpp
============================================================
#include "testtextfinder.h"
#include "ui_testtextfinder.h"
#include <QtCore/QFile>
#include <QtCore/QTextStream>
testTextFinder::testTextFinder(QWidget *parent) :
QWidget(parent),
ui(new Ui::testTextFinder)
{
ui->setupUi(this);
loadTextFile();
}
testTextFinder::~testTextFinder()
{
delete ui;
}
void testTextFinder::on_findButton_clicked()
{
QString searchString = ui->lineEdit->text();
ui->textEdit->find(searchString, QTextDocument::FindWholeWords);
}
void testTextFinder::loadTextFile()
{
QFile inputFile(":/input.txt");
inputFile.open(QIODevice::ReadOnly);
QTextStream in(&inputFile);
QString line = in.readAll();
inputFile.close();
ui->textEdit->setPlainText(line);
QTextCursor cursor = ui->textEdit->textCursor();
cursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor, 1);
}
共
条评分
回复
举报
离线
ebony
UID:111470
注册时间
2011-01-21
最后登录
2011-09-09
在线时间
0小时
发帖
4
搜Ta的帖子
精华
0
金钱
40
威望
14
贡献值
0
好评度
4
访问TA的空间
加好友
用道具
新手上路
加关注
发消息
只看该作者
2楼
发表于: 2011-02-01
#ifndef TESTTEXTFINDER_H
#define TESTTEXTFINDER_H
#include <QWidget>
namespace Ui {
class testTextFinder;
}
class testTextFinder : public QWidget
{
Q_OBJECT
public:
explicit testTextFinder(QWidget *parent = 0);
~testTextFinder();
private:
Ui::testTextFinder *ui;
void loadTextFinder();
private slots:
void on_findButton_clicked();
};
#endif // TESTTEXTFINDER_H
共
条评分
回复
举报
离线
jdwx
UID:107742
注册时间
2010-11-12
最后登录
2016-02-01
在线时间
4619小时
发帖
2939
搜Ta的帖子
精华
0
金钱
30465
威望
3015
贡献值
0
好评度
3005
访问TA的空间
加好友
用道具
论坛版主
加关注
发消息
只看该作者
3楼
发表于: 2011-02-01
最好不要改类名,很麻烦的。改的时候用查找替换方法还方便一点,看错误信息估计是还有一部分没改过来。
还有就是不要把自己的程序放到QT目录下!就是QT自己带的例子在原来的目录里都不能被正确编译,移到其它目录里就能编译。就是一点经验。
[ 此帖被jdwx在2011-02-01 10:16重新编辑 ]
共
条评分
发帖时要说明:操作系统、Qt版本、编译器,这样能更快的得到回复。
回复
举报
离线
ebony
UID:111470
注册时间
2011-01-21
最后登录
2011-09-09
在线时间
0小时
发帖
4
搜Ta的帖子
精华
0
金钱
40
威望
14
贡献值
0
好评度
4
访问TA的空间
加好友
用道具
新手上路
加关注
发消息
只看该作者
4楼
发表于: 2011-02-01
但我用了CTRL+F查找,应该全部改过来了. 而且,该TUTORIAL的.h文件只有一个, .cpp也不过就两个, 都是很少的代码.
实在看不出来哪里还有没改过来的类名字.
难道QT会自己生成隐藏的库? 即便如此, 我建项目的时候, 就已经将名字改为TestTextFinder了,它也应该按照新名字生成吧.
共
条评分
回复
举报
离线
jdwx
UID:107742
注册时间
2010-11-12
最后登录
2016-02-01
在线时间
4619小时
发帖
2939
搜Ta的帖子
精华
0
金钱
30465
威望
3015
贡献值
0
好评度
3005
访问TA的空间
加好友
用道具
论坛版主
加关注
发消息
只看该作者
5楼
发表于: 2011-02-04
#include "ui_testtextfinder.h"这个文件改了吗?改这个有点麻烦,它是由UI生成的,还是在UI文件里改吧!
共
条评分
发帖时要说明:操作系统、Qt版本、编译器,这样能更快的得到回复。
回复
举报
发帖
回复
返回列表
http://www.qtcn.org/bbs
访问内容超出本站范围,不能确定是否安全
继续访问
取消访问
快速回复
限100 字节
您目前还是游客,请
登录
或
注册
进入高级模式
文字颜色
发 布
回复后跳转到最后一页
上一个
下一个
关闭
补充发布信息
验证码:
发 布
隐藏
快速跳转
站务及资讯
网站公告
新闻资讯
Qt官方发布
网站管理
Qt应用及资源
Qt 作品展
Qt代码秀
Qt应用版
Qt技术讨论区
Qt安装与发布
Qt中文处理
Qt基础编程
Qt QML开发
Qt嵌入式开发
Qt移动平台开发
其它技术开发讨论区
Qt图书专区
《C++ GUI Qt 4编程》(第2版)专栏
《Qt高级编程》专栏
《零基础学Qt4编程》专栏
《Qt设计模式》(第2版) 图书专栏
Python Qt GUI快速编程
Qt项目开发区
天池项目
Qt开放平台开发库
Qt版百度云笔记
机械CAD
Qt文档计划
QTCN网站系统开发
扇贝词典
非活跃项目区
社区中心
帖子回收站(Trash)
招聘、求职、供求、广告等
休闲娱乐
关闭
关闭
选中
1
篇
全选