cannot convert 'b2PolygonShape' to 'objc_object*' in argument passing

Posted by GONeale on Stack Overflow See other posts from Stack Overflow or by GONeale
Published on 2010-04-10T06:58:06Z Indexed on 2010/04/10 7:03 UTC
Read the original article Hit count: 577

Hey there,

I am not sure if many of you are familiar with the box2d physics engine, but I am using it within cocos2d and objective c.

This more or less could be a general objective-c question though, I am performing this:

NSMutableArray *allShapes = [[NSMutableArray array] retain]; 
b2PolygonShape shape;
..
..
[allShapes addObject:shape];

and receiving this error on the addObject definition on build:

cannot convert 'b2PolygonShape' to 'objc_object*' in argument passing

So more or less I guess I want to know how to add a b2PolygonShape to a mutable array. b2PolygonShape appears to just be a class, not a struct or anything like that. The closest thing I could find on google to which I think could do this is described as 'encapsulating the b2PolygonShape as an NSObject and then add that to the array', but not sure the best way to do this, however I would have thought this object should add using addObject, as some of my other instantiated class objects add to arrays fine.

Is this all because b2PolygonShape does not inherit NSObject at it's root?

Thanks

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa