• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : 入门讨论帖--编译qt文件出的错误,大家一起看看。 复制链接 | 浏览器收藏 | 打印
失败的原因只有一个,那就是半途而废!
级别: 侠客
UID: 12490
精华: 0
发帖: 56
金钱: 290 两
威望: 58 点
综合积分: 112 分
注册时间: 2010-01-07
最后登录: 2015-09-28
楼主  发表于: 2010-01-14 22:36

 入门讨论帖--编译qt文件出的错误,大家一起看看。

  用qt designer  生成了  .ui文件
然后运用.ui文件,# uic -o *.h *.ui  
                                # uic -o *.cpp -impl *.h *.ui  
生成了. cpp  和  .h文件
编辑了mian.cpp  然后用友善hello里面的./build  编译

这个是整个包
err.rar (3 K) 下载次数:11

提示下列错误

[root@localhost first]# ./build
WARNING: Found potential symbol conflict of first.cpp (first.cpp) in SOURCES
WARNING: Found potential symbol conflict of first.h (first.h) in HEADERS
Makefile:177: warning: overriding commands for target `.obj/release-shared/first.o'
Makefile:162: warning: ignoring old commands for target `.obj/release-shared/first.o'
Makefile:183: warning: overriding commands for target `.obj/release-shared/moc_first.o'
Makefile:180: warning: ignoring old commands for target `.obj/release-shared/moc_first.o'
Makefile:189: warning: overriding commands for target `.moc/release-shared/moc_first.cpp'
Makefile:186: warning: ignoring old commands for target `.moc/release-shared/moc_first.cpp'
rm -f .obj/release-shared/moc_first.o .obj/release-shared/moc_first.o
rm -f .moc/release-shared/moc_first.cpp .moc/release-shared/moc_first.cpp
rm -f .ui/release-shared/first.cpp .ui/release-shared/first.h
rm -f .obj/release-shared/first.o .obj/release-shared/main.o .obj/release-shared/first.o
rm -f *~ core *.core
Makefile:177: warning: overriding commands for target `.obj/release-shared/first.o'
Makefile:162: warning: ignoring old commands for target `.obj/release-shared/first.o'
Makefile:183: warning: overriding commands for target `.obj/release-shared/moc_first.o'
Makefile:180: warning: ignoring old commands for target `.obj/release-shared/moc_first.o'
Makefile:189: warning: overriding commands for target `.moc/release-shared/moc_first.cpp'
Makefile:186: warning: ignoring old commands for target `.moc/release-shared/moc_first.cpp'
/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/bin/uic first.ui -o .ui/release-shared/first.h
/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/bin/uic first.ui -i first.h -o .ui/release-shared/first.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os  -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"first\" -DQTOPIA_TRTARGET=\"first\" -DQT_NO_DEBUG -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-generic-g++ -I. -I../qtopia-2.2.0-FriendlyARM/qtopia/include -I../qtopia-2.2.0-FriendlyARM/qt2/include -I.ui/release-shared/ -I.moc/release-shared/ -o .obj/release-shared/first.o .ui/release-shared/first.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os  -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"first\" -DQTOPIA_TRTARGET=\"first\" -DQT_NO_DEBUG -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-generic-g++ -I. -I../qtopia-2.2.0-FriendlyARM/qtopia/include -I../qtopia-2.2.0-FriendlyARM/qt2/include -I.ui/release-shared/ -I.moc/release-shared/ -o .obj/release-shared/main.o main.cpp
/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/bin/moc .ui/release-shared/first.h -o .moc/release-shared/moc_first.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -Os  -DQTOPIA_DATA_LINKING -DQCONFIG=\"qconfig-qpe.h\" -DQTOPIA_TARGET=\"first\" -DQTOPIA_TRTARGET=\"first\" -DQT_NO_DEBUG -I/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/mkspecs/qws/linux-generic-g++ -I. -I../qtopia-2.2.0-FriendlyARM/qtopia/include -I../qtopia-2.2.0-FriendlyARM/qt2/include -I.ui/release-shared/ -I.moc/release-shared/ -o .obj/release-shared/moc_first.o .moc/release-shared/moc_first.cpp
test -d /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/opt/Qtopia/bin/ || mkdir -p /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/opt/Qtopia/bin/
g++  -o /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/opt/Qtopia/bin/first .obj/release-shared/first.o .obj/release-shared/main.o .obj/release-shared/first.o .obj/release-shared/moc_first.o .obj/release-shared/moc_first.o   -lqtopia2 -lqtopia -lqpe -L/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/lib -L/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/lib -lqte
.obj/release-shared/first.o: In function `first::push()':
first.cpp:(.text+0x0): multiple definition of `first::push()'
.obj/release-shared/first.o:first.cpp:(.text+0x0): first defined here
.obj/release-shared/first.o: In function `non-virtual thunk to first::~first()':
first.cpp:(.text+0x10): multiple definition of `non-virtual thunk to first::~first()'
.obj/release-shared/first.o:first.cpp:(.text+0x10): first defined here
.obj/release-shared/first.o: In function `first::~first()':
first.cpp:(.text+0x18): multiple definition of `first::~first()'
.obj/release-shared/first.o:first.cpp:(.text+0x18): first defined here
.obj/release-shared/first.o: In function `first::~first()':
first.cpp:(.text+0x32): multiple definition of `first::~first()'
.obj/release-shared/first.o:first.cpp:(.text+0x32): first defined here
.obj/release-shared/first.o: In function `non-virtual thunk to first::~first()':
first.cpp:(.text+0x4b): multiple definition of `non-virtual thunk to first::~first()'
.obj/release-shared/first.o:first.cpp:(.text+0x4b): first defined here
.obj/release-shared/first.o: In function `first::~first()':
first.cpp:(.text+0x52): multiple definition of `first::~first()'
.obj/release-shared/first.o:first.cpp:(.text+0x52): first defined here
.obj/release-shared/first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0x7e): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
.obj/release-shared/first.o:first.cpp:(.text+0x7e): first defined here
.obj/release-shared/first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0x2b6): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
.obj/release-shared/first.o:first.cpp:(.text+0x2b6): first defined here
.obj/release-shared/moc_first.o: In function `first::className() const':
moc_first.cpp:(.text+0x0): multiple definition of `first::className() const'
.obj/release-shared/moc_first.o:moc_first.cpp:(.text+0x0): first defined here
.obj/release-shared/moc_first.o: In function `first::staticMetaObject()':
moc_first.cpp:(.text+0x2a): multiple definition of `first::staticMetaObject()'
.obj/release-shared/moc_first.o:moc_first.cpp:(.text+0x2a): first defined here
.obj/release-shared/moc_first.o:(.bss+0x0): multiple definition of `first::metaObj'
.obj/release-shared/moc_first.o:(.bss+0x0): first defined here
.obj/release-shared/moc_first.o: In function `first::tr(char const*, char const*)':
moc_first.cpp:(.text+0xaa): multiple definition of `first::tr(char const*, char const*)'
.obj/release-shared/moc_first.o:moc_first.cpp:(.text+0xaa): first defined here
.obj/release-shared/moc_first.o: In function `first::tr(char const*)':
moc_first.cpp:(.text+0xd4): multiple definition of `first::tr(char const*)'
.obj/release-shared/moc_first.o:moc_first.cpp:(.text+0xd4): first defined here
.obj/release-shared/moc_first.o: In function `first::initMetaObject()':
moc_first.cpp:(.text+0xfe): multiple definition of `first::initMetaObject()'
.obj/release-shared/moc_first.o:moc_first.cpp:(.text+0xfe): first defined here
collect2: ld returned 1 exit status
make: *** [/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/opt/Qtopia/bin/first] Error 1
[root@localhost first]#
[ 此帖被douzidouer在2010-01-16 08:46重新编辑 ]
失败的原因只有一个,那就是半途而废!
失败的原因只有一个,那就是半途而废!
级别: 侠客
UID: 12490
精华: 0
发帖: 56
金钱: 290 两
威望: 58 点
综合积分: 112 分
注册时间: 2010-01-07
最后登录: 2015-09-28
1楼  发表于: 2010-01-14 22:40
对了还有一个  .pro文件是我把hello  里的文件考过来然后把 对应的文件修改得到的
失败的原因只有一个,那就是半途而废!
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2010-01-15 10:08
g++  -o /opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/image/opt/Qtopia/bin/first .obj/release-shared/first.o .obj/release-shared/main.o .obj/release-shared/first.o .obj/release-shared/moc_first.o .obj/release-shared/moc_first.o   -lqtopia2 -lqtopia -lqpe -L/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qtopia/lib -L/opt/FriendlyARM/mini2440/x86-qtopia/qtopia-2.2.0-FriendlyARM/qt2/lib -lqte

从编译的输出看,最后链接时first.o和moc_first.o都链接了两遍,当然会出现重复的symbol定义。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
失败的原因只有一个,那就是半途而废!
级别: 侠客
UID: 12490
精华: 0
发帖: 56
金钱: 290 两
威望: 58 点
综合积分: 112 分
注册时间: 2010-01-07
最后登录: 2015-09-28
3楼  发表于: 2010-01-16 08:44

我查看的生成的Makefile,的确是有重复的项目,我把重复的变异选项给删除掉后,编译仍旧有错。正在分析原因。
顺便问下  有同志按照这个帖子的两种方法 测试成功的么?
            帖子如下:http://www.aiothome.net/read.php?tid-2998.html
失败的原因只有一个,那就是半途而废!
级别: 圣骑士
UID: 9221
精华: 0
发帖: 376
金钱: 2110 两
威望: 539 点
综合积分: 752 分
注册时间: 2009-09-22
最后登录: 2016-07-04
4楼  发表于: 2010-01-17 17:23
这个是我可以编译成功的例子,不知对你有用不!
附件: first.tar.gz (27 K) 下载次数:18
一起学习,一起进步
失败的原因只有一个,那就是半途而废!
级别: 侠客
UID: 12490
精华: 0
发帖: 56
金钱: 290 两
威望: 58 点
综合积分: 112 分
注册时间: 2010-01-07
最后登录: 2015-09-28
5楼  发表于: 2010-01-17 19:39
谢谢您的例子,您是按照上面那个帖子做的么?
  
失败的原因只有一个,那就是半途而废!
级别: 圣骑士
UID: 9221
精华: 0
发帖: 376
金钱: 2110 两
威望: 539 点
综合积分: 752 分
注册时间: 2009-09-22
最后登录: 2016-07-04
6楼  发表于: 2010-01-17 19:43
我看过TQ的,做成功过,包括ARM-qtopia的,用上面链接的方法也可以
一起学习,一起进步
失败的原因只有一个,那就是半途而废!
级别: 侠客
UID: 12490
精华: 0
发帖: 56
金钱: 290 两
威望: 58 点
综合积分: 112 分
注册时间: 2010-01-07
最后登录: 2015-09-28
7楼  发表于: 2010-01-17 21:34
我看了
调用ui库和不用ui库是两种方法。
我用tq的方法也实现了,谢谢你的例子。
但是那篇帖子的第一种方法我还是没有做成功。
准备在看看具体文件分析下原因。
失败的原因只有一个,那就是半途而废!
走自己的路,让别人去说!
级别: 侠客
UID: 11808
精华: 0
发帖: 86
金钱: 450 两
威望: 90 点
综合积分: 172 分
注册时间: 2009-12-21
最后登录: 2014-04-10
8楼  发表于: 2010-01-19 16:40
引用第7楼douzidouer于2010-01-17 21:34发表的  :
我看了
调用ui库和不用ui库是两种方法。
我用tq的方法也实现了,谢谢你的例子。
但是那篇帖子的第一种方法我还是没有做成功。
准备在看看具体文件分析下原因。

我在Fedora 9中同样碰到了你这样的问题··没有测试成功 ··不知道如何解决啊··
对知识的追求永无止境
失败的原因只有一个,那就是半途而废!
级别: 侠客
UID: 12490
精华: 0
发帖: 56
金钱: 290 两
威望: 58 点
综合积分: 112 分
注册时间: 2010-01-07
最后登录: 2015-09-28
9楼  发表于: 2010-01-19 20:31
引用第8楼381762390于2010-01-19 16:40发表的  :

我在Fedora 9中同样碰到了你这样的问题··没有测试成功 ··不知道如何解决啊··



建议你看下http://www.aiothome.net/read.php?tid-4399.html  这个帖子
然后好好的看你的cpp  h  pro  文件
问题就在这个4个文件里面了
我的那个问题在main。cpp文件里面
我是把两种方法和在一起使用,结果显而易见会有缺少文件的情况。
希望有什么问题大家再交流。
失败的原因只有一个,那就是半途而废!
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go