cpSpaceAddCollisionHandler编译器警告问题
我的程序中有以下内容(似乎工作正常),但会导致编译器警告:
从不兼容的指针类型传递 cpSpaceAddCollisionHandler 的参数 7。
cpSpaceAddCollisionHandler(space, COLLISION_TYPE_BALL, COLLISION_TYPE_LEFT_WALL, collisionBallWallBegin, nil, nil, collisionBallWallEnd, self);
collisionBallWallBegin
不会导致此警告,并且这两种方法声明相同:
static int collisionBallWallBegin (cpArbiter *arb, cpSpace *space, void *data)
我
static int collisionBallWallEnd(cpArbiter *arb, cpSpace *space, void *data)
不明白为什么我会收到警告,这让我发疯!
I have the following in my program (which seems to be working perfectly), but causes a compiler warning:
Passing argument 7 of cpSpaceAddCollisionHandler from incompatible pointer type.
cpSpaceAddCollisionHandler(space, COLLISION_TYPE_BALL, COLLISION_TYPE_LEFT_WALL, collisionBallWallBegin, nil, nil, collisionBallWallEnd, self);
collisionBallWallBegin
does not cause this warning and the two methods are declared the same:
static int collisionBallWallBegin (cpArbiter *arb, cpSpace *space, void *data)
and
static int collisionBallWallEnd(cpArbiter *arb, cpSpace *space, void *data)
I can't figure out why I am getting the warning and it is driving me nuts!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
begin
需要是一个cpCollisionBeginFunc
,它接受三个参数并返回一个cpBool
。相比之下,
separate
需要是cpCollisionSeparateFunc
,它接受三个参数并且不返回值。begin
needs to be acpCollisionBeginFunc
, which takes three arguments and returns acpBool
.In comparison,
separate
needs to be acpCollisionSeparateFunc
, which takes three arguments and does not return a value.