Friday, June 1, 2012

Problems with Cocos2D Tutorials and Solutions

Many of the Cocos2D for iPhone tutorials and examples were written for earlier versions. I downloaded the 0.82 version and found that some things needed to be done a little differently from the examples / tutorials before the compile errors could be solved. I went through the tutorials without using the templates (in other words, I started from a new windows-based application).

The tutorials I was referring to are:
I have only gotten to Hello World working but here are some of the things I've had to do.

On the part where you add the "external" folder into the project, a lot of the sub-folders inside had to be deleted for the project to even compile (in addition to deletions recommended by the above tutorials).
  • Box2D wouldn't compile so I had to remove it.
  • libpng had a duplicate main symbol as pngtest.c declares a main function too. Deleting the entire folder didn't seem to cause any problems so off it goes.
  • Deleted TouchJSON folder too as a precautionary measure since one of the tutorials mentioned that it wasn't really needed.
Next, the project still wouldn't compile because it was needed a ZipUtils class. This was solved by adding the libz.1.2.3.dylib framework, as advised here: www.cocos2d-iphone.org/forum/topic/1302
Lastly, the HelloWorld class in the examples sub-classed CCLayer, a class I couldn't find in 0.82. I changed it to sub-class the Layer class and the HelloWorld demo worked fine.

No comments:

Post a Comment