Search code examples
c++g++bulletphysics

Bullet basic project error: undefined reference to `btTypedConstraint::serialize(void*, btSerializer*) const'


I have been trying to link bullet to an existing project. I was able to compile and install the source and the example programs, but I can't compile a basic empty file.

here is the test.cpp code:

#include "btBulletDynamicsCommon.h"
#include <stdio.h>

int main()
{
    return 0;
}

and the error:

g++ -std=c++11 -o run test.cpp -I /usr/local/include/bullet/ /usr/local/lib/libBullet3Dynamics.a /usr/local/lib/libBulletCollision.a /usr/local/lib/libLinearMath.a

/tmp/ccvDsyTQ.o:(.rodata._ZTV17btTypedConstraint[_ZTV17btTypedConstraint]+0x60): undefined reference to `btTypedConstraint::serialize(void*, btSerializer*) const'
collect2: error: ld returned 1 exit status
Compilation failed.

Solution

  • The btBulletDynamicsCommon.h header includes the 2.x part of the library, which requires libBulletDynamics.a. Version 3 (libBullet3Dynamics.a) is incomplete and not recommended for use.