error linking

pyalot
Posts: 5
Joined: Wed Sep 02, 2009 9:12 am

error linking

Post by pyalot »

I'm trying to build a shared library depending on bullet. I'm building it like this:

Code: Select all

g++ -I../src -c -fPIC bullet.cpp -o bullet.o
g++ -shared -Wl,-soname,bullet.so -o bullet.so bullet.o libBulletDynamics.a libLinearMath.a libBulletCollision.a
The source is:

Code: Select all

#include "btBulletDynamicsCommon.h"
extern "C"{
     void* test(){
        return new btDefaultCollisionConfiguration();
    }
}
But when I try to load bullet.so with dlopen I get:
./bullet.so: undefined symbol: _Z21btAlignedFreeInternalPv
Using a different source, for instance the one below, I don't get this error.

Code: Select all

#include "btBulletDynamicsCommon.h"
extern "C"{
     void* test(){
        return new btVector3(0, 0, 0);
    }
}
Any idea?