Qt程序编辑

软件和网站开发以及相关技术探讨
头像
comfanter
帖子: 190
注册时间: 2009-05-02 14:51

Re: Qt程序编辑

#16

帖子 comfanter » 2009-11-06 16:29

-DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o main.o main.cpp
看看这两行
wangjun403
帖子: 433
注册时间: 2009-07-06 14:26

Re: Qt程序编辑

#17

帖子 wangjun403 » 2009-11-06 16:45

makefile里找不到你所说的那两句
生命只不过是上帝借你一用的资本!
头像
comfanter
帖子: 190
注册时间: 2009-05-02 14:51

Re: Qt程序编辑

#18

帖子 comfanter » 2009-11-06 17:01

那是编译产生的信息,你用新立得搜索qt3,然后把包含qt3的都删除
wangjun403
帖子: 433
注册时间: 2009-07-06 14:26

Re: Qt程序编辑

#19

帖子 wangjun403 » 2009-11-07 14:38

谢谢
生命只不过是上帝借你一用的资本!
wangjun403
帖子: 433
注册时间: 2009-07-06 14:26

Re: Qt程序编辑

#20

帖子 wangjun403 » 2009-11-08 20:35

请问如何用GDB调试QT的程序?

就是前面发的那个程序,生成了可执行文件后

代码: 全选

wangjun@wj-dt:~/qt/chap01/hello$ ls
hello  hello.cpp  hello.pro  Makefile

代码: 全选

wangjun@wj-dt:~/qt/chap01/hello$ gdb hello
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/wangjun/qt/chap01/hello/hello...done.
(gdb) b main
Breakpoint 1 at 0x80488b3
(gdb) run
Starting program: /home/wangjun/qt/chap01/hello/hello 
[Thread debugging using libthread_db enabled]

Breakpoint 1, 0x080488b3 in main ()
(gdb) s
Single stepping until exit from function main, 
which has no line number information.


不能像其他C程序一样但不调试什么的,请问下这是怎么回事?
生命只不过是上帝借你一用的资本!
头像
wangdu2002
帖子: 13284
注册时间: 2008-12-13 19:39
来自: 物华天宝人杰地灵

Re: Qt程序编辑

#21

帖子 wangdu2002 » 2009-11-08 20:37

还是买本Qt编程的书,系统学习和编程实践下吧。。。Qt的问题可以到Qt中文论坛去找贴子。。。 :em06
行到水穷处,坐看云起时。
海内生明月,天涯共此夕。
--------------------吾本独!
wangjun403
帖子: 433
注册时间: 2009-07-06 14:26

Re: Qt程序编辑

#22

帖子 wangjun403 » 2009-11-08 20:46

书上也没有说怎么用GDB调试QT程序的阿
生命只不过是上帝借你一用的资本!
keyu21
帖子: 33
注册时间: 2007-02-28 0:06

Re: Qt程序编辑

#23

帖子 keyu21 » 2009-11-15 19:03

试试下面的代码来编译

代码: 全选

/opt/qtsdk-2009.04/qt/bin/qmake -project
/opt/qtsdk-2009.04/qt/bin/qmake
make
通常自己下载的SDK安装于/opt下
头像
md5xwl
帖子: 133
注册时间: 2008-10-29 22:16
联系:

Re: Qt程序编辑

#24

帖子 md5xwl » 2009-11-17 8:42

不是tmake吗?

代码: 全选

苏老泉,二十七,始发愤,读书籍。彼既老,犹悔迟。尔小生,宜早思!!
tusooa
帖子: 6548
注册时间: 2008-10-31 22:12
系统: 践兔
联系:

Re: Qt程序编辑

#25

帖子 tusooa » 2009-12-09 20:35

wangjun403 写了:

代码: 全选

wangjun@wj-dt:~/workspace/hellomake$ ls
main.cpp
wangjun@wj-dt:~/workspace/hellomake$ cat main.cpp
#include <QApplication>
#include <QLabel>

int main(int argc, char *argv[])
{
	QApplication app(argc,argv);                    //创建对象
	QLabel *label=new QLabel("hello zhangrong!");   //QLabel对象,小控件
	label->show();
	return app.exec();               //让程序进入æM -&
wangjun@wj-dt:~/workspace/hellomake$ 

代码: 全选

wangjun@wj-dt:~/workspace/hellomake$ qmake -project
wangjun@wj-dt:~/workspace/hellomake$ ls
hellomake.pro  main.cpp
wangjun@wj-dt:~/workspace/hellomake$ qmake
wangjun@wj-dt:~/workspace/hellomake$ ls
hellomake.pro  main.cpp  Makefile
wangjun@wj-dt:~/workspace/hellomake$ make
g++ -c -pipe -g -Wall -W -O2 -D_REENTRANT  -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DQT_SHARED -DQT_TABLET_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/include/qt3 -o main.o main.cpp
main.cpp:1:24: error: QApplication: 没有该文件或目录
main.cpp:2:18: error: QLabel: 没有该文件或目录
main.cpp: In function ‘int main(int, char**)’:
main.cpp:6: error: ‘QApplication’ was not declared in this scope
main.cpp:6: error: expected ‘;’ before ‘app’
main.cpp:7: error: ‘QLabel’ was not declared in this scope
main.cpp:7: error: ‘label’ was not declared in this scope
main.cpp:7: error: expected type-specifier before ‘QLabel’
main.cpp:7: error: expected ‘;’ before ‘QLabel’
main.cpp:9: error: ‘app’ was not declared in this scope
main.cpp:9: error: expected ‘}’ at end of input
main.cpp: At global scope:
main.cpp:4: warning: unused parameter ‘argc’
main.cpp:4: warning: unused parameter ‘argv’
make: *** [main.o] 错误 1
wangjun@wj-dt:~/workspace/hellomake$ 
这应该是没有找到QT的函数库,我该把文件放在那里?
或者是其他地方错了

代码: 全选

s qmake &-qt4 g

代码: 全选

] ls -ld //
回复