I'm trying to use ODE in my C project on Xcode 4.5.1 (MacOS 10.8). I used
./autogen.sh
./configure
make
sudo make install
to install the lib. I then tried to compile a test program:
#include <stdio.h>
#include <ode/ode.h>
int main(int argc, const char * argv[]) {
dWorldID world = dWorldCreate();
return 0;
}
I added dSINGLE
in Build Settings->Preprocessor Macros and libode.a
in my Xcode project.
When I try to build and run I get a bunch of errors like
Undefined symbols for architecture x86_64:
"std::terminate()", referenced from:
_dJointGroupCreate in libode.a(ode.o)
_dBodyCreate in libode.a(ode.o)
dxJointBall::dxJointBall(dxWorld*) in libode.a(ball.o)
dxJointBall::dxJointBall(dxWorld*) in libode.a(ball.o)
dxJointFixed::dxJointFixed(dxWorld*) in libode.a(fixed.o)
dxJointFixed::dxJointFixed(dxWorld*) in libode.a(fixed.o)
dxJointHinge::dxJointHinge(dxWorld*) in libode.a(hinge.o)
...
.
.
.
.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The very same procedure works fine if I create a C++ project instead of a C one.
Did I forget to add something in the build settings in order to make it work?
Solved adding
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/libstdc++.dylib
to the Xcode project.