Sorry if this is a really obvious answer, but how do I link Box2D?
I’ve tried the normal download of Box2D, and also with it installed through Homebrew, and I can have the header files found, but when I try to compile my program I get the errors
Undefined symbols for architecture i386:
"b2World::b2World(b2Vec2 const&)", referenced from:
ofApp::setup() in ofApp.o
"b2World::~b2World()", referenced from:
ofApp::setup() in ofApp.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I’m new to using c++ libraries and stuff, so I’m at a bit of a loss for what to do.
I’m not exactly sure what you mean by linking the the ofxBox2d folder – I’d recommend using the Project Generator (it’s included in the openFrameworks distribution) to create an xcode project with the ofxBox2D addon. After copying the ofxBox2d folder to the openFrameworks/addons/ folder open project generator, name your project, click to the addons section to include ofxBox2D and then generate it.
Sure, it is possible to do it manually, but it is a little more complicated. You should be able to drag the addon into the project tree and then you’ll need to add the addon’s headers to the header search path.
To see an example of that, look at one of the ofxBox2D project settings. Here’s where you find them in Xcode: