Box2D: 错误variable length array of non-POD element type 'b2Vec2'
2014-08-18 15:37
381 查看
Variable length of non-POD element type 'b2Vec2'!!怎么会报出这个错误呢?
真有点儿搞不懂了,刚进入ios开发的时候用的是一个朋友的mac笔记本
他的系统是雪豹的,在雪豹的XCode下面我记得是一点儿问题都没有的,警告也就是某某变量声明过后未被使用
蛋疼了,再看代码,操了,标准的c、c++写法啊...
在栈上定义一个b2Vec2数组也不行,不兴这样的吧?!如下图所示:
自打用上狮子以来,这个问题烦扰我好几次了,虽然项目能够正常编译通过并执行
但我就是觉得不爽,明明没错的东西还给报错,这不等于混淆视听么!!
前几天观摩别人的项目的时候不能正常运行,我在项目文件中重新设置了一下项目的编译器,竟然达到了我的目的~
想到这儿反正我也没有别的办法了,不如死马当做活马医,于是也改了一下编译器,
将编译器由 "LLVM GCC 4.2" 改成了 "GCC 4.2",没想到竟然也奏效了
下面是更改过之后重新运行时的IDE 界面
混淆试听的鸡肋错误提示被赶走了,仿佛大热天里啃上一根老冰棒,爽!
当然,这只是表面现象,其实还是有必要探讨一下为什么会出现这样的错误的:
如第二张图中所示,其实xcode的编译器总共有3种:
1.Apple LLVM compiler 2.1
2.GCC 4.2
3.LLVM GCC 4.2
iOS5结构体编译严格
问题描述:今天二罗升级iOS SDK5,发现Monster不能编译了。具体报错信息如下:
variable length array of non-POD element type 'b2Vec2'
问题分析:错误指向的是cocos2d里一个结构体数组定义,如下:
b2Vec2 vertices[vertexCount];
问题解决:把其改成指针形式,如下:
b2Vec2 *vertices = new b2Vec2[vertexCount];
真有点儿搞不懂了,刚进入ios开发的时候用的是一个朋友的mac笔记本
他的系统是雪豹的,在雪豹的XCode下面我记得是一点儿问题都没有的,警告也就是某某变量声明过后未被使用
蛋疼了,再看代码,操了,标准的c、c++写法啊...
在栈上定义一个b2Vec2数组也不行,不兴这样的吧?!如下图所示:
自打用上狮子以来,这个问题烦扰我好几次了,虽然项目能够正常编译通过并执行
但我就是觉得不爽,明明没错的东西还给报错,这不等于混淆视听么!!
前几天观摩别人的项目的时候不能正常运行,我在项目文件中重新设置了一下项目的编译器,竟然达到了我的目的~
想到这儿反正我也没有别的办法了,不如死马当做活马医,于是也改了一下编译器,
将编译器由 "LLVM GCC 4.2" 改成了 "GCC 4.2",没想到竟然也奏效了
下面是更改过之后重新运行时的IDE 界面
混淆试听的鸡肋错误提示被赶走了,仿佛大热天里啃上一根老冰棒,爽!
当然,这只是表面现象,其实还是有必要探讨一下为什么会出现这样的错误的:
如第二张图中所示,其实xcode的编译器总共有3种:
1.Apple LLVM compiler 2.1
2.GCC 4.2
3.LLVM GCC 4.2
iOS5结构体编译严格
问题描述:今天二罗升级iOS SDK5,发现Monster不能编译了。具体报错信息如下:
variable length array of non-POD element type 'b2Vec2'
问题分析:错误指向的是cocos2d里一个结构体数组定义,如下:
b2Vec2 vertices[vertexCount];
问题解决:把其改成指针形式,如下:
b2Vec2 *vertices = new b2Vec2[vertexCount];
相关文章推荐
- Box2D: 错误variable length array of non-POD element type 'b2Vec2'
- qt 错误:request for member 'show' in 'showlist_ui', which is of non-class type 'ShowList*'
- variable 'std:ofstream' has initializer but incomplete type 错误
- error: request for member '*' in '*', which is of non-class type '*'
- 错误:invalid use of non-static data member 'main_form::zhiliu_datainfo'
- hibernate:newclass.hbm.xml文件错误(the content of element type "class" must match "(meta*,column*,type?generator?...)
- 错误:A SPI class of type org.apache.lucene.*** with name 'Whitespace' does not exist.
- 解决dev express quantumgrid v6.30使用中出现'Overflow while converting variant of type(Integer) into type(Date)'的错误
- cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'错误
- Undefined function or method ' ' for input arguments of type 'double' ---错误解决办法
- cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'错误
- cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'错误
- variable 'std:ofstream' has initializer but incomplete type
- Pointer to non-const type 'PLTexture*'with no explicit ownership错误,解决办法
- “cvc-complex-type.2.4.a: Invalid content was found starting with element 'book'”错误的解决办法
- “cvc-complex-type.2.4.a: Invalid content was found starting with element 'taglib'”错误的解决办法
- 'FILE' : illegal use of this type as an expression编译错误的解决
- Sending 'ccColor4B' (aka 'struct _ccColor4B') to parameter of incompatible type 'CIColor *'错误
- iOS:编译错误Local declaration of ‘XXXX' hides instance variable