I've recently switched from Visual Studio on Windows to Ubuntu. I'm working on a project that used the LinearMath part of Bullet.
When I try to compile my program I get an undefined reference to "btAlignedAllocInternal(unsigned long, int)" error.
On windows I only reference to the LinearMath library but I figured out that the btAlignedAllocInternal may actually be defined in Bullet3Common. So I link to both of them.
Probably something I'm overlooking but I could use some help in finding out what.
My "program" looks as follows:
Code: Select all
#include <iostream>
#include "btVector3.h"
int main() {
std::cout << "Hello world...\n";
btVector3* test = new btVector3(1,2,3);
std::cout << "...Hello to you " << test[1] << "\n";
return 0;
}
Code: Select all
g++ \
-O3 \
-Wall \
-std=c++14 \
-fPIC \
-DBT_USE_DOUBLE_PRECISION \
-Ibullet3/src/LinearMath \
-Lbullet3/build_cmake/src/Bullet3Common \
-lBullet3Common \
-Lbullet3/build_cmake/src/LinearMath \
-lLinearMath \
main.cpp
echo "Build completed; running program"
./a.out
Code: Select all
/tmp/ccDDKxGV.o: In function `main':
main.cpp:(.text.startup+0x27): undefined reference to `btAlignedAllocInternal(unsigned long, int)'
collect2: error: ld returned 1 exit status