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

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

我一直在尝试 link 项目符号到现有项目。我能够编译和安装源程序和示例程序,但是我不能编译一个基本的空文件。

这里是 test.cpp 代码:

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

int main()
{
    return 0;
}

和错误:

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.

btBulletDynamicsCommon.h header 包括库的 2.x 部分,这需要 libBulletDynamics.a。版本 3 (libBullet3Dynamics.a) 不完整,不推荐使用。