Problem use Bullet for a personal project on Linux

Furix64
Posts: 9
Joined: Thu Feb 12, 2009 8:57 am

Problem use Bullet for a personal project on Linux

Post by Furix64 »

Hello,

I have compile Bullet correctly on my system : Linux (Ubuntu). I can start the demo.
(my post for install: http://www.bulletphysics.com/Bullet/php ... f=9&t=3201)

But now I need to use it for a personal project.

I have test two method: But I have error.

My makefile is:

Code: Select all

INCLUDE := -I/.../bullet-2.73/
LIBS := -L /.../bullet-2.73/src -libbulletdynamics -libbulletcollision -libbulletmath

all: Main.o
	g++ Main.o $(LIBS) -o Hello

Main.o: Main.cpp
	g++ $(INCLUDE) -c Main.cpp

The directory : .../bullet-2.73/ is the directory where I compile Bullet.

My error :

Code: Select all

/usr/bin/ld: cannot find -libbulletdynamics
collect2: ld a retourné 1 code d'état d'exécution
make: *** [all] Erreur 1
I think I don't have the good include, but I don't understand what include need my project for compiling correctly...

Thanks a lot in advance!

ps: sorry for my bad English, I'm a French student.
Enrico
Posts: 42
Joined: Thu May 17, 2007 9:34 am
Location: Stuttgart, Germany

Re: Problem use Bullet for a personal project on Linux

Post by Enrico »

Your linker options are definitely wrong.

The libraries are named "libsomething.so". When you want to link against this library, you only give something to the linker.
Next thing, your paths are completely wrong. You might want to use two dots only instead of three and remove the first slash.

All in all, something like:

Code: Select all

LIBS := -L../bullet-2.73/src -lbulletdynamics -lbulletcollision -lbulletmath
Furix64
Posts: 9
Joined: Thu Feb 12, 2009 8:57 am

Re: Problem use Bullet for a personal project on Linux

Post by Furix64 »

Hello,

Thanks for your help Enrico.

I understand my problem, I didn't know work the linker option. Now I think I know.

The solution of my problem, I have modified my makefile:

Code: Select all

INCLUDE := -I/.../bullet-2.73/src
LIBS1 := -L /.../bullet-2.73/src/BulletDynamics -lBulletDynamics
LIBS2 := -L /.../bullet-2.73/src/BulletCollision -lBulletCollision
LIBS3 := -L /.../bullet-2.73/src/LinearMath -lLinearMath

all: Main.o
	g++ Main.o $(LIBS1) $(LIBS2) $(LIBS3) -o Hello

Main.o: Main.cpp
	g++ $(INCLUDE) -c Main.cpp

May be another solution exist, but this makefile can compile the Hello_World on this page (http://www.bulletphysics.com/mediawiki- ... ello_World)

Thanks a lot.

Edit :
Next thing, your paths are completely wrong. You might want to use two dots only instead of three and remove the first slash.
/.../ : isn't in my true makefile, it's for exemple.