Just thought I would share the following info on adding Box2D to your own iPhone projects
- Drag the Box2D folder into your project (select "Copy items into destination group's folder (if needed)" to make a copy of the files)
- Change File Type from c.objc to cpp.objcpp (Use command-select your .m source files, then right click->Get Info->General->File Type)
- Select Project->Project Settings->Build (Use search)
--> Always Search User Paths: YES
--> Header Search Paths: "$(SRCROOT)" (put a tick next to recursive)
--> Compile for Thumb: NO (this is because thumb is slow when using floating point)
--> Other C Flags / Other C++ Flags: -DTARGET_OS_IPHONE
- You may get some errors about malloc. This just means you have to cast explicitly.
Eg.
If the error is "Invalid conversion from 'void*' to 'SomeType*', then change it to..
EDIT: Sorry this should probably be moved to "Build Issues".
- Drag the Box2D folder into your project (select "Copy items into destination group's folder (if needed)" to make a copy of the files)
- Change File Type from c.objc to cpp.objcpp (Use command-select your .m source files, then right click->Get Info->General->File Type)
- Select Project->Project Settings->Build (Use search)
--> Always Search User Paths: YES
--> Header Search Paths: "$(SRCROOT)" (put a tick next to recursive)
--> Compile for Thumb: NO (this is because thumb is slow when using floating point)
--> Other C Flags / Other C++ Flags: -DTARGET_OS_IPHONE
- You may get some errors about malloc. This just means you have to cast explicitly.
Eg.
Code: Select all
value = malloc(size);If the error is "Invalid conversion from 'void*' to 'SomeType*', then change it to..
Code: Select all
value = (SomeType*) malloc(size);EDIT: Sorry this should probably be moved to "Build Issues".