-fno-rtti

undefined reference to `typeinfo for QCollectio...

不羁的心 提交于 2019-12-09 11:02:38
今天交叉编译qte应用程序时,遇到下面的编译链接问题: /tmp/ccWGP9rp.o:(.rodata._ZTI6QGList[typeinfo for QGList]+0x8): undefined reference to `typeinfo for QCollection' collect2: ld returned 1 exit status make: *** [hello_qt] Error 1s 一开始以为是qte库的裁剪导致部分特性功能的缺失造成了,可是找了半天也没有找到和QCollection相关的特性红,而且按照qconfig-dist.h配置编译qte库后,问题依旧。后来检查编译选项,是缺少编译选项-fno-rtti导致的,加上就好了。编译命令参考: arm-hismall-linux-g++ -ohello_qt hello_qt.cpp -DQWS -pipe -fno-rtti -fno-exceptions 选项简要说明: -pipe 使用管道代替编译中临时文件,在使用非gnu汇编工具的时候,可能有些问题 -fno-rtti 不生成带虚拟函数类的运行时类型识别(Run-Time Type Identification)功能(dynamic_cast and typeid)信息,不使用该功能时,使用该选项可以节省空间。 -fno-exceptions