交叉编译STL程序报错

在将一个X86的程序移植到arm时,有一个文件始终编译不通过,并报一大堆的STL错误,怀疑是编译器的问题

在X86下我用的编译器是3.2.2  arm-linux-gcc 版本2.95.3

下面是错误的节选


arm-linux-g++ a.cpp
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../include/g++-3/stl_iterator.h: In function `void destroy<W *>(W *, W *)':
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../include/g++-3/stl_iterator.h:154: template instantiation depth exceeds maximum of 17
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../include/g++-3/stl_iterator.h:154:  (use -ftemplate-depth-NN to increase the maximum)
a.cpp:165:   instantiated from here
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../include/g++-3/stl_construct.h:78: confused by earlier errors, bailing out

 

其中有一条是模板深度太深,也是写一测试程序

struct A

{

    vector<int> a;

};

struct B

{

   vector<A> b;

};

...

struct Z

{

    vector<Z> z;

};

这个小程序也会报上面的错误,说明模板深度的问题由此引起,在我的正式程序中,可能函数嵌套调用导致此问题的发生

将此测试程序用arm-linux-gcc 3.3.2编译通过,证明了2.95.3不能支持


 

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值