永发信息网

Qt编译不成功(X86)

答案:2  悬赏:20  手机版
解决时间 2021-04-21 18:24
  • 提问者网友:溺爱和你
  • 2021-04-21 10:01

在"make”的时候出错,终端显示如下

root@EmbedSky first]# make
Makefile:132: warning: overriding commands for target `moc_first.cpp'
Makefile:129: warning: ignoring old commands for target `moc_first.cpp'
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86_qtopia/qt/include -I/opt/EmbedSky/Qte/x86_qtopia/qtopia/include -o
first.o first.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86_qtopia/qt/include -I/opt/EmbedSky/Qte/x86_qtopia/qtopia/include -o
main.o main.cpp
g++ -c -pipe -DQWS -fno-exceptions -fno-rtti -Wall -W -O2 -DNO_DEBUG -I/opt/EmbedSky/Qte/x86_qtopia/qt/include -I/opt/EmbedSky/Qte/x86_qtopia/qtopia/include -o
moc_first.o moc_first.cpp
g++ -o /opt/EmbedSky/Qte/x86_qtopia/qtopia/bin/first first.o main.o first.o moc_first.o moc_first.o -L/opt/EmbedSky/Qte/x86_qtopia/qtopia/lib -L/opt/EmbedSky/Qte/x86_qtopia/qt/lib -lqpe -lqtopia -lqte
first.o(.text+0x0): In function `first::first[not-in-charge](QWidget*, char const*, unsigned)':
: multiple definition of `first::first[not-in-charge](QWidget*, char const*, unsigned)'
first.o(.text+0x0): first defined here
first.o(.text+0x344): In function `first::first[in-charge](QWidget*, char const*, unsigned)':
: multiple definition of `first::first[in-charge](QWidget*, char const*, unsigned)'
first.o(.text+0x344): first defined here
first.o(.text+0x688): In function `first::~first [not-in-charge]()':
: multiple definition of `first::~first [not-in-charge]()'
first.o(.text+0x688): first defined here
first.o(.text+0x6ac): In function `first::~first [in-charge]()':
: multiple definition of `first::~first [in-charge]()'
first.o(.text+0x6ac): first defined here
first.o(.text+0x6d0): In function `first::~first [in-charge deleting]()':
: multiple definition of `first::~first [in-charge deleting]()'
first.o(.text+0x6d0): first defined here
first.o(.text+0x6fc): In function `first::event(QEvent*)':
: multiple definition of `first::event(QEvent*)'
first.o(.text+0x6fc): first defined here
first.o(.text+0x778): In function `first::user_button()':
: multiple definition of `first::user_button()'
first.o(.text+0x778): first defined here
moc_first.o(.text+0x0): In function `first::className() const':
: multiple definition of `first::className() const'
moc_first.o(.text+0x0): first defined here
moc_first.o(.data+0x0): multiple definition of `first::metaObj'
moc_first.o(.data+0x0): first defined here
moc_first.o(.text+0xc): In function `first::initMetaObject()':
: multiple definition of `first::initMetaObject()'
moc_first.o(.text+0xc): first defined here
moc_first.o(.text+0xcc): In function `first::staticMetaObject()':
: multiple definition of `first::staticMetaObject()'
moc_first.o(.text+0xcc): first defined here
moc_first.o(.text+0x74): In function `first::tr(char const*)':
: multiple definition of `first::tr(char const*)'
moc_first.o(.text+0x74): first defined here
moc_first.o(.text+0xa0): In function `first::tr(char const*, char const*)':
: multiple definition of `first::tr(char const*, char const*)'
moc_first.o(.text+0xa0): first defined here
collect2: ld returned 1 exit status
make: *** [/opt/EmbedSky/Qte/x86_qtopia/qtopia/bin/first] Error 1

最佳答案
  • 五星知识达人网友:行路难
  • 2021-04-21 11:22
难啊 这样就不好搞了
全部回答
  • 1楼网友:孤独的牧羊人
  • 2021-04-21 12:40

"multiple definition" 重复定义,检查检查代码,看是不是 .h文件没有使用#ifdefine XXX_H #define XXX_H...来保证.h文件只被包含一次。

另外这种技术问题,还是多使用google搜搜看吧,还有论坛,qtcn.org 和qt.msdn.net

http://qtcn.org/bbs/home.php

http://qt.csdn.net

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯