I am getting > 2000 compile errors, all which point to Bullet source files, if I try compiling with an #import statement to anything Bullet inside an Objective-C header. I am not having trouble including C++ headers from within my own project, i.e. any C++ source I wrote myself. Also, I am not having any trouble getting a good Bullet example to work properly as long as I use Bullet imports in my interface implementations (.m). Another thing is, if I try creating a project for Mac (rather than iOS), I do not run into this problem. I know it's possible to do this. I have searched all over for a solution and found plenty of examples of people doing exactly this without error. I suspect it must be related to the way I included Bullet into my project, but I really don't know.

The way I included Bullet into the project was by creating a new target, calling it "bullet," adding "bullet" as a "Direct Dependency" to my main target and including the library "libbullet.a" into this target. I then right click on my "bullet" target and add existing files. I select three folders inside the bullet-2.78 src folder: BulletDynamics, BulletCollision, and LinearMath. I set my header search paths to the src directory and change the source type of any .m file that imports Bullet to sourcecode.cpp.objcpp. This all works just fine. I can compile the project and get zero errors and zero warnings. However, doing something like this (below) will make XCode asplode:
Code: Select all
// Ship.h
#import "Vec3.h"
#import "Vec4.h"
#import "btBulletDynamicsCommon.h" // this line, XCode no likey
@interface Ship : NSObject
{
Vec3 *position, *velocity, *acceleration;
Vec3 *localX, *localY, *localZ;
float thrustForce, damping, matrix[16];
BOOL useThruster;
}
Code: Select all
[in file btCollisionWorld.h]
#ifndef BT_COLLISION_WORLD_H
#define BT_COLLISION_WORLD_H
class btStackAlloc; // this line here is what it's complaining about
...
/Users/pogalog/Documents/GLEssentials 2/bullet-2.78/src/BulletCollision/CollisionDispatch/btCollisionWorld.h:68:0 /Users/pogalog/Documents/GLEssentials 2/bullet-2.78/src/BulletCollision/CollisionDispatch/btCollisionWorld.h:68: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'btStackAlloc'
Thanks for looking,
Nathan