天嵌 ARM开发社区

 找回密码
 注册
查看: 8409|回复: 17

求救:qt开发

[复制链接]
wzq204 发表于 2010-6-13 10:49:08 | 显示全部楼层 |阅读模式
本帖最后由 wzq204 于 2010-6-13 10:58 编辑

我仿照兲嵌科技出品--QT程序开发完全手册(上).pdf的文档的第三章,开发了第一个应用程序,发现执行到3.9(编译并仿真),出现了编译错误。不知道,怎么解决。
[root@EmbedSky first]# make
Makefile:130: warning: overriding commands for target `moc_first.cpp'
Makefile:127: warning: ignoring old commands for target `moc_first.cpp'
g++  -o /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/bin/first first.o main.o first.o moc_first.o   -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/lib -L/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/lib -lqpe -lqtopia -lqte
first.o: In function `first::user_button()':
first.cpp:(.text+0x0): multiple definition of `first::user_button()'
first.o:first.cpp:(.text+0x0): first defined here
first.o: In function `first::event(QEvent*)':
first.cpp:(.text+0x10): multiple definition of `first::event(QEvent*)'
first.o:first.cpp:(.text+0x10): first defined here
first.o: In function `non-virtual thunk to first::~first()':
first.cpp:(.text+0x100): multiple definition of `non-virtual thunk to first::~first()'
first.o:first.cpp:(.text+0x100): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x110): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x110): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x130): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x130): first defined here
first.o: In function `non-virtual thunk to first::~first()':
first.cpp:(.text+0x150): multiple definition of `non-virtual thunk to first::~first()'
first.o:first.cpp:(.text+0x150): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x160): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x160): first defined here
first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0x190): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
first.o:first.cpp:(.text+0x190): first defined here
first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0x590): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
first.o:first.cpp:(.text+0x590): first defined here
collect2: ld returned 1 exit status
make: *** [/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/image/opt/Qtopia/bin/first] Error 1



[root@EmbedSky first]# arm-linux-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /scratch/maxim/arm-lite/src-4.3-arm-none-linux-gnueabi-lite/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q1-176' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/libc --with-gmp=/scratch/maxim/arm-lite/obj-4.3-arm-none-linux-gnueabi-lite/host-libs-2009q1-176-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/maxim/arm-lite/obj-4.3-arm-none-linux-gnueabi-lite/host-libs-2009q1-176-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/maxim/arm-lite/install-4.3-arm-none-linux-gnueabi-lite/arm-none-linux-gnueabi/bin
Thread model: posix
gcc version 4.3.3 (Sourcery G++ Lite 2009q1-176)
[root@EmbedSky first]#
 楼主| wzq204 发表于 2010-6-13 13:47:34 | 显示全部楼层
修改main.cpp文件
#include "first.h"
#include <qapplication.h>
//#include </opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/qpeapplication.h>
#include <qtopia/qpeapplication.h>

QTOPIA_ADD_APPLICATION("first",first)
QTOPIA_MAIN
执行make命令后:
[root@EmbedSky first]# make
Makefile:130: warning: overriding commands for target `moc_first.cpp'
Makefile:127: warning: ignoring old commands for target `moc_first.cpp'
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/usr/lib/qt-3.3/include -I/include -o main.o main.cpp
main.cpp:4:35: error: qtopia/qpeapplication.h: No such file or directory
main.cpp:6: error: expected constructor, destructor, or type conversion before ‘(’ token
make: *** [main.o] Error 1
[root@EmbedSky first]#

再次修改main.cpp文件
#include "first.h"
#include <qapplication.h>
#include </opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/qpeapplication.h>
//#include <qtopia/qpeapplication.h>

QTOPIA_ADD_APPLICATION("first",first)
QTOPIA_MAIN
执行make命令后
[root@EmbedSky first]# make
Makefile:130: warning: overriding commands for target `moc_first.cpp'
Makefile:127: warning: ignoring old commands for target `moc_first.cpp'
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/usr/lib/qt-3.3/include -I/include -o main.o main.cpp
In file included from /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/qpeapplication.h:1,
                 from main.cpp:3:
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/../../src/libraries/qtopia/qpeapplication.h:38:30: error: qtopia/qpeglobal.h: No such file or directory
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/../../src/libraries/qtopia/qpeapplication.h:41:31: error: qtopia/timestring.h: No such file or directory
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/../../src/libraries/qtopia/qpeapplication.h:202:41: error: qtopia/applicationinterface.h: No such file or directory
In file included from /opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/qpeapplication.h:1,
                 from main.cpp:3:
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/../../src/libraries/qtopia/qpeapplication.h:53: error: function definition does not declare parameters
main.cpp: In function ‘int main(int, char**)’:
main.cpp:7: error: ‘QPEApplication’ was not declared in this scope
main.cpp:7: error: expected `;' before ‘a’
main.cpp:7: error: ‘a’ was not declared in this scope
main.cpp:7: error: ‘a’ was not declared in this scope
main.cpp:7: error: ‘a’ was not declared in this scope
main.cpp: At global scope:
main.cpp:7: warning: unused parameter ‘argc’
make: *** [main.o] Error 1
[root@EmbedSky first]#
cplly 发表于 2010-6-13 16:36:47 | 显示全部楼层
你看老的文档的吧,Makefile里有重复的语句要删
亚瑟王 发表于 2010-6-13 18:01:51 | 显示全部楼层
1、Makefile文件中有重复信息;
2、main.cpp文件内容说明在4.4章节,建议你阅读一遍。
 楼主| wzq204 发表于 2010-6-17 15:30:04 | 显示全部楼层
谢谢大家关注:我修改了Makfie文件后,就可以编译通过。
现在我还有一个疑问,我做了一个LEDtest的QT应用实例,发现一个问题,这个应用实例下载到开发板上后,发现一直有“兲嵌科技”的标签信息。这个控件,我根本没做。

请问一下,如何把这个标签信息去掉哪?

另外,QT的这个风格的实例是我不需要的,我需要从头做一个QT的实例,不知道有没有相关的文档?
 楼主| wzq204 发表于 2010-6-18 15:46:58 | 显示全部楼层
你好,我尝试了一下用qt4.5,文档上所有的功能都可以实现,
但是我的qt creater却不能调试,并且提示
you can't do that without a process to debug

请问一下这个问题怎么解决啊?
亚瑟王 发表于 2010-6-18 19:23:32 | 显示全部楼层
你调试时是怎么操作的?
 楼主| wzq204 发表于 2010-6-18 20:34:50 | 显示全部楼层
本帖最后由 wzq204 于 2010-6-18 20:45 编辑

是完全按照资料操作的啊!
QTcreater 能不能像VC一样,在PC机上运行仿真,在计算机能够看到运行的结果?
然后再把这个可执行文件下载到开发板上。
亚瑟王 发表于 2010-6-19 18:42:24 | 显示全部楼层
qtcreator不能用于调试qt2的程序的。
 楼主| wzq204 发表于 2010-6-21 08:59:44 | 显示全部楼层
本帖最后由 wzq204 于 2010-6-21 09:05 编辑

我现在就是调试的的qt4教程上的例子(第六章),我调试的结果和文档上是一样的,单击了Build->Build Project "mainwindow"时,编译时通过的没有任何错误。
但是一旦我点击了Biuld->Run时,却不能执行,并且显示了错误代码是 255。
错误提示:
Starting /opt/EmbedSky/qt-4.5/qt-embedded-linux-opensource-src-4.5.0/demos/mainwindow/mainwindow...
/opt/EmbedSky/qt-4.5/qt-embedded-linux-opensource-src-4.5.0/demos/mainwindow/mainwindow exited with code 255

我的疑问是,qtcreate能不能在PC机上仿真执行的结果,然后再把二进制文件下载到开发板上?

如果不能再PC机上仿真的话,qtcreate根本就不能用啊,做一个大型的程序,如果只能到开发板上仿真的话,效率也太差了。

这个问题也被其他人碰到过,可以参考一下,他们的解决方法,但是我尝试了一下,却没有成功。
http://www.qtcn.org/bbs/simple/?t25838.html
 楼主| wzq204 发表于 2010-6-21 16:20:28 | 显示全部楼层
我在/etc/ld.so.conf.d 的目录下建立一个/etc/ld.so.conf.d 的文件,文件的内容是:/opt/EmbedSky/qt-4.5/build/build_x86/lib
在终端运行命令:sudo ldconfig。
结果:you can't do that without a process to debug的对话框消失了。
点击调试命令后显示了新的错误:
QWSSocket::connectToLocalFile could not connect:: Connection refused
QWSSocket::connectToLocalFile could not connect:: Connection refused
QWSSocket::connectToLocalFile could not connect:: Connection refused
QWSSocket::connectToLocalFile could not connect:: Connection refused
QWSSocket::connectToLocalFile could not connect:: Connection refused
QWSSocket::connectToLocalFile could not connect:: Connection refused
No Qt for Embedded Linux server appears to be running.
If you want to run this program as a server,
add the "-qws" command-line option.
请大家指点!!
亚瑟王 发表于 2010-6-22 19:02:18 | 显示全部楼层
Qt4的仿真参考这个帖子的内容吧。
http://bbs.embedsky.net/viewthre ... &extra=page%3D4
 楼主| wzq204 发表于 2010-6-23 11:40:57 | 显示全部楼层
现在终于把qt的仿真的问题解决了,我把解决的具体过程大体讲一下,希望大家能够少走一些弯路。
最终用兲嵌的qt4.5的源代码也没有实现在线仿真的功能。
我仿照http://blog.chinaunix.net/u3/113851/showart_2238951.html这个文章完成了整个的调试过程。
(1)在文章的第4步(tslib、qte-arm 的移植和配置)我省略掉没做,只是用兲嵌光盘自带的root文件。
(2)完成这个文章的1~3的步骤后,没找到qt-creator的sdk的应用程序,所以我又从网上下了最新的qt-creator的安装包(单独安装这个安装包也没调通,老是出现上面的错误),安装包的名称是qt-sdk-linux-x86-opensource-2010.03.bin。安装好qt-creator的应用程序后,用了刚才编译的qmake(x86和arm版本的),就可以用x86版本的qmake上仿真,编译arm版本的qmake下载到开发板上。
亚瑟王 发表于 2010-6-24 11:06:43 | 显示全部楼层
qt-creater的功能是很强大的,不过主要看你怎么用它的那些功能了,在PC上仿真是完全可行的。
 楼主| wzq204 发表于 2010-6-24 15:57:57 | 显示全部楼层
真是郁闷,刚刚把qt4.5的qtcreator的安装程序调试好,又发现qt designer的菜单显示不出来,可能是字体颜色和背景颜色一样吧!尝试了各种方法,qtcreator的菜单的字体颜色都能改掉,就是qt designer的字体改不掉。很多人讲是fedore10的一个bug,安装在fedore8中就没这样的问题。
这几天在尝试一下,换个系统试一试。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-9-27 23:21 , Processed in 1.045938 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表