Qt embedded 建立

本文介绍了一种在使用Qt进行编译时遇到的链接错误问题及其解决方案。问题表现为使用arm-linux-gcc进行链接时出现未定义引用错误,通过将链接器从gcc更改为g++成功解决了该问题。

arm-linux-g++  -c -I/opt/qt/qt-2.3.10/include -pipe -DQWS -fno-exceptions -fno-r
tti -O2 -Wall -W -DNO_DEBUG  -o main.o main.cpp
arm-linux-gcc -L/opt/qt/qt-2.3.10/lib -Wl,-rpath,/opt/qt/qt-2.3.10/lib   -o ./t1
 main.o   -lqte -lm
/opt/qt/qt-2.3.10/lib/libqte.so: undefined reference to `operator new[](unsigned
 int)'
/opt/qt/qt-2.3.10/lib/libqte.so: undefined reference to `operator delete(void*)'
/opt/qt/qt-2.3.10/lib/libqte.so: undefined reference to `__cxa_pure_virtual'
/opt/qt/qt-2.3.10/lib/libqte.so: undefined reference to `operator delete[](void*
)'
/opt/qt/qt-2.3.10/lib/libqte.so: undefined reference to `operator new(unsigned i
nt)'
collect2: ld returned 1 exit status
make[4]: *** [t1] Error 1
make[4]: Leaving directory `/opt/qt/qt-2.3.10/tutorial/t1'
make[3]: *** [t1] Error 2
make[3]: Leaving directory `/opt/qt/qt-2.3.10/tutorial'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/opt/qt/qt-2.3.10/tutorial'
make[1]: *** [sub-tutorial] Error 2
make[1]: Leaving directory `/opt/qt/qt-2.3.10'
make: *** [init] Error 2

【原因】:
原因是Makefile 里的LINK 项应该为g++ 而不是gcc , 修改
tmake/lib/qws/linux-generic-g++/tmake.conf
#vi $TMAKEPATH/tmake.conf
将TMAKE_LINK = gcc 和TMAKE_LINK_SHLIB = gcc
分别修改成
TMAKE_LINK = g++和TMAKE_LINK_SHLIB = g++
#tmake –o Makefile hello.pro
此时查看Makefile 里的LINK 项应该已经为g++

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

钱国正

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值