天嵌 ARM开发社区

 找回密码
 注册
查看: 2030|回复: 5

学习Qt第三章遇到问题

[复制链接]
小胖子 发表于 2010-8-4 08:48:32 | 显示全部楼层 |阅读模式
到Qt教材的第二章我都成功编译好了开发环境,到第三章我按照教材,成功生成了所有所需要的文件,按照教材,把Makefile文件里面按照教材修改好了,也把重复的地方删除了。其他文件也都按教材修改好了。
   然后我在输入命令make后,系统编译了一会,最后显示ld returned 1 exit status。编译信息如下:
   [root@localhost First]# make
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include -o first.o first.cpp
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include/qtooltip.h:87: warning: ‘class QToolTip’ has virtual functions but non-virtual destructor
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include -o main.o main.cpp
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include/qdatetime.h:51: warning: ‘class QDate’ has virtual functions but non-virtual destructor
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/../../src/libraries/qtopia/qcom.h:88: warning: ‘struct QUnknownInterface’ has virtual functions but non-virtual destructor
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/../../src/libraries/qtopia/qcom.h:100: warning: ‘struct QLibraryInterface’ has virtual functions but non-virtual destructor
/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include/qtopia/../../src/libraries/qtopia/applicationinterface.h:49: warning: ‘struct ApplicationInterface’ has virtual functions but non-virtual destructor
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qt2/include -I/opt/EmbedSky/Qte/x86-qtopia-2.2.0/qtopia/include -o moc_first.o 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::~first()':
first.cpp:(.text+0x0): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x0): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x30): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x30): first defined here
first.o: In function `first::~first()':
first.cpp:(.text+0x50): multiple definition of `first::~first()'
first.o:first.cpp:(.text+0x50): first defined here
first.o: In function `first::user_button()':
first.cpp:(.text+0x70): multiple definition of `first::user_button()'
first.o:first.cpp:(.text+0x70): first defined here
first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0xf0): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
first.o:first.cpp:(.text+0xf0): first defined here
first.o: In function `first::first(QWidget*, char const*, unsigned int)':
first.cpp:(.text+0x420): multiple definition of `first::first(QWidget*, char const*, unsigned int)'
first.o:first.cpp:(.text+0x420): 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
亚瑟王 发表于 2010-8-4 22:32:13 | 显示全部楼层
Makefile文件中应该还是有重复信息。
 楼主| 小胖子 发表于 2010-8-5 15:37:43 | 显示全部楼层
2# 亚瑟王
我和教材的Makefile对照过了,是一模一样的呢!
shabby 发表于 2010-8-6 12:54:14 | 显示全部楼层
我也遇到和lz一样问题,求亚瑟王解答
super2071 发表于 2010-8-9 15:44:46 | 显示全部楼层
估计有没修改的地方
 楼主| 小胖子 发表于 2010-8-15 18:31:59 | 显示全部楼层
5# super2071
我后来仔细做了Makefile文件,然后编译成功了,不过,对于之前为什么没成功,我还是不知道。十分感谢你精彩的回答,帮我坚定信心,好好编写程序!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

GMT+8, 2024-9-27 23:24 , Processed in 1.029336 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

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