Got the code from the Chipmunk 6.0.0 zipfile on the main site (BTW ObjectiveChipmunk isn't in the 6.0.1 archive...)
My code is pretty boilerplate - I'm using the suggested "chipmunkObjects as a synthesized property" method:
Code: Select all
// as properties in header
ChipmunkBody *body;
ChipmunkShape *shape;
NSSet *chipmunkObjects;
// in implementation
shape = [ChipmunkPolyShape boxWithBody:body width:size.width height:size.height];
shape.elasticity = 0.3f;
shape.friction = 0.3f;
shape.data = self;
if (chipmunkObjects) [chipmunkObjects release];
chipmunkObjects = [ChipmunkObjectFlatten(body, shape, nil) retain];
I'm importing ObjectiveChipmunk.h via the class's header file, and it compiles, so it's aware that ChipmunkObjectFlatten should exist. It just doesn't work in the linkage, which would seem to indicate that it's not finding it in the pre-built simulator .a object file? I think I'm calling it correctly... maybe you can tell from the code I put above.
Full error:
Undefined symbols for architecture i386:
"ChipmunkObjectFlatten(objc_object*, ...)", referenced from:
-[GameObject setShapeAsBox:] in GameObject.o
-[GameObject setShapeAsCircle:] in GameObject.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
I'm using a iPhone 4.3 simulator target.
slembcke wrote:That's weird. That's the only symbol it says is missing? That would be really weird. My best guesses in that case:
- You missed an import statement.
- Are you sure it was spelled correctly
- You are using it in a way that makes the compiler think it's not actually a function?
Posting some of the code might help I guess? Are there any warnings or other errors? Where did you get the lib from?