How to Create Your Own Cocos2d Project Template
In this article, I will present how to create your own Cocos2d project template. The version of Cocos2d is 0.8. The approach used in this article can also be applied when creating the project template using other static libraries.
Step 1: Download the Cocos2d library from here. Untar the file, then move the folder cocos2d-iphone-0.8 to /Developer/Library. For convenience in following steps, we first add a source entry in xcode Preferences as follows:

Step 2: Make a copy of Window-Based Application Template and name it with “My Cocos2d Application“. On my desktop, Window-Based Application Template locates in folder /Developer/Platforms/iphoneos.platform/developer/library/xcode/project templates/application. Place the copied template My Cocos2d Application in the same folder.
Step 3: Get into the folder My Cocos2d Application, and open the file ___PROJECTNAME___.xcodeproj. Delete MainWindow.xib from the Resources group because Cocos2d project doesn’t need this nib file.
Step 4: Edit Info.plist file. Remove entry “Main nib file base name”. Add a UIStatusBarHidden entry to hide status bar.

Step 5: Add some required libraries. Double Click the target “___PROJECTNAME___” to open Target Info dialog. Click “+” button under Linked Libraries. Add the libraries shown below:

Step 6: Go to the folder of Cocos2d library /Developer/Library/cocos2d-iphone-0.8, drag and drop the file cocos2d-iphone.xcodeproj under “___PROJECTNAME___” on the sidebar. Please don’t check “Copy items into destination group’s fold (if needed)”. Select “Reletive to COCOS2D_SRC” as the Reference Type. The screen shot is shown below:

Then what we need to do is ticking the required Cocos2d static libraries (libChipmunk.a, libcocos2d.a, libbox2d.a) as shown below:

Step 7: Add Dependencies. Double click the target “___PROJECTNAME___” to open Target Info dialog. Click “+” button under Direct Dependencies. Add box2d, Chipmunk, cocos2d to the dependency list.

Step 8: Add “User Header Search Paths“. Double click “___PROJECTNAME___” to open project Info dialog. Under Build Tab, double click “User Header Search Paths” and you will see the following dialog. Add the same path shown in the picture.

Step 9: Updating the codes. The codes actually depend on your requirements. You can download an example of files main.m and ___PROJECTNAMEASIDENTIFIER___AppDelegate.m from here. Note: updating the main function in main.m is necessary.
int main(int argc, char *argv[]) { NSAutoreleasePool *pool = [NSAutoreleasePool new]; int retVal = UIApplicationMain(argc, argv, nil, @"___PROJECTNAMEASIDENTIFIER___AppDelegate"); [pool release]; return retVal; }
Step 10: Add fps_images.png to Resources.
All done! Now you can create a new Cocos2d project with the project template you just created.

After build.. i have 3 errors.
Please Help!
error comment
“.object_class_name_TextureMgr”, referenced from:
literal-pointer@__OBJC@__cls_refs@TextureMgr in ??AppDelegate.o
“.object_class_name_Scene”, referenced from:
literal-pointer@__OBJC@__cls_refs@Scene in ??AppDelegate.o
“.object_class_name_Director”, referenced from:
literal-pointer@__OBJC@__cls_refs@Director in ??AppDelegate.o
symbol(s) not found
collect2:Id returned 1 exit status
me too…
@wolhaju
@kukat
Hi, could you please provide more information? or send me your project or project template? it’s a little hard to say where the problem is.
My email: jiangli001 [AT] gmail.com
@wolhaju
According to the codes kukat sent me, you probably didn’t add libcocos2d.a to the
project template. Please follow step 6 to do that.
Help.
I followed the above with no joy. I have tried both verion .8 and .8.1 bit with the same error when I try to run it. It is one error (Argument list too long: recursive header xpansion failed at /Developer/Documentation/DocSet/…) and it goes on way pass what I can see on the screen.
What is this and how can I fix it?