Chipmunk Help

Discussion in 'iOS Programming' started by Wellington2k, Jan 4, 2012.

  1. Wellington2k macrumors regular

    Joined:
    Jun 4, 2011
    #1
    Hello.

    I just started to try and learn how to use Chipmunk, but I've run into a problem.

    When I try to run this code (used for updating the shapes):
    Code:
    - (void)tick:(NSTimer *)timer {
    	cpSpaceStep(space, 1.0f/60.0f);
    	cpSpaceHashEach((*space).activeShapes_private, &updateShape(nil, nil));
    }
    I get this error:
    address expression must be an lvalue or a function designator

    The original code used for this was:
    Code:
    - (void)tick:(NSTimer *)timer {
    	cpSpaceStep(space, 1.0f/60.0f);
    	cpSpaceHashEach(space->activeShapes, &updateShape, nil);
    }
    But that gave me 8 errors:
    "_cpSpaceStep", referenced from:

    "_cpSpaceHashEach", referenced from:

    "_cpInitChipmunk", referenced from:

    "_cpSpaceNew", referenced from:

    "_cpBodyNew", referenced from:

    "_cpSpaceAddBody", referenced from:

    "_cpCircleShapeNew", referenced from:

    "_cpSpaceAddShape", referenced from:

    I don't know what to do, sense I just started.

    Any help?
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    Those errors are linker errors and they mean that the specified functions are referenced in your app but they don't exist. You either need to add the static library that contains them to your project or add the source code files that have those functions in them to your project.
     
  3. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
  4. seepel macrumors 6502

    seepel

    Joined:
    Dec 22, 2009
    #4
    Have you verified that all the chipmunk source files are being added to the "Compile Soirces" Buil Phase? I've noticed that if you have multiple targets sometimes XCode doesn't add them to the target you expect, maybe something similar happened to you. I'd also check and make sure the files got copied into the project and not just added to the list, this would probably give other errors though but XCode is a big piece of software and I like to check simple things first.
     
  5. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
    #5
    I tried add them all under Compiler Sources and for every file I add I get this warning and the errors above.

    I put this problem in the Chipmunk forum too and a person told me to use this code instead of the ones listed above:

    Code:
    cpSpaceEachShape(space, nil, nil);
    And I get the errors from the bottom of the first post.
     
  6. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
    #6
    Found out the problem.

    I was using old code with new files.

    But now I get errors from a file I have to use. (I'm not going to go into detail)

    I'm sick of Chipmunk. Is Box2d any easier?
     
  7. seepel macrumors 6502

    seepel

    Joined:
    Dec 22, 2009
    #7
    If you're using cocos2D you might want to try SpaceManager. It's an Objective-C wrapper around the most commonly used chipmunk code. It has simplified my life quite a bit.
     
  8. Wellington2k thread starter macrumors regular

    Joined:
    Jun 4, 2011
    #8
    I've pretty much quit Chipmunk and gone to Box2d.

    I've used Box2d before.
     

Share This Page