Skip to main content

Posts

Showing posts with the label box2d

Adding box2d header causes a torrent of compiler errors

I am experiencing either an extremely weird error or a temporary loss of brain function. I have a box2d / cocos project running in XCode. This all works fine but my code is currently a proof of concept "hack". Stage one of cleaning up the code is creating classes for various objects. Now, if I create a brand new Objective C class (inherited off NSObject) as below it all compiles fine. As soon as I attempt to import the "Box2D.h" I receive a gazillion errors originating from the box2d library saying it cannot be built. 201 to be precise and it indicates no issues with the class itself. Can anyone shed any light? I have already tried a clean and rebuild as well as restarting XCode. My super complicated class definition #import "Box2D.h" @interface test : NSObject @end An example compiler error thrown Expected '=', ',', ';', 'asm' or '__attribute__' before 'b2Fixture' in /Users/..../libs/Box2D/Dynamics

iOS import causing tons of errors?

I'm trying to set up a menu in my cocos2d game and whenever I import Game.h I end up with over 200 errors. It's a cocos2d app with box2d, I'm not sure why it's throwing all these errors though- the game was running perfectly before I swapped loading the Game scene for the MainMenu scene initially. The line of code I'm running is [[CCDirector sharedDirector] replaceScene: [Game node]]; The import of 'Game' causes the errors. Can anyone give me an idea about this? Some information that may be helpful... I originally created the project loading into Game.m but switched it to MainMenu and then import Game.h into MainMenu to access the object. ANY insight is appreciated! Thank you!