Box2D: 错误variable length array of non-POD element type 'b2Vec2'
2014-03-08 22:57
239 查看
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
问题描述:今天二罗升级iOS SDK5,发现Monster不能编译了。具体报错信息如下:
问题分析:错误指向的是cocos2d里一个结构体数组定义,如下:
b2Vec2 vertices[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结构体编译严格
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'
- Variable length of non-POD element type 'b2Vec2'可能原因之一
- Find longest covered length of non overlapping interval subsets
- pod出现include of non-modular header inside framework module 错误
- Given a set of n symbols a size k and a combination of length k of non repeating characters from the symbol set
- How to get the length of array of strings in C? - Yahoo! Answers
- 编译错误:error: invalid initialization of non-const reference of type ‘*&’ from a temporary of type
- JAVA错误:Cannot refer to a non-final variable * inside an inner class defined in a different method
- ns2.33 nam [code omitted because of length] 错误
- Array-Maximum Length of Repeated Subarray
- 【转】NS2中解决nam [code omitted because of length]错误
- gcc Variable-length_array
- 关于错误提示Must explicitly describe intended ownership of an object array parameter
- JAVA错误:Cannot refer to a non-final variable * inside an inner class defined in a different method
- oc错误:control reaches end of non-void function
- Cannot modify the return value of ...,because it is not a variable 错误分析与解决
- iOS中使用opencv碰到这样的编译错误:non-const static data member must be initialized out of line
- gcc编译错误 warning: control reaches end of non-void function|
- 出现错误"illegal call of non-static member function"?