Problem compiling examples

inakin
Posts: 9
Joined: Wed Jan 16, 2008 6:36 pm

Problem compiling examples

Post by inakin »

I am starting with bullet physics. I can compile the examples using the Jam system but I have problems when I try to compile the BasicExample without use Jam. I get the .o file but when I try to link the executable file I have this answer:

/usr/lib/bullet/libbulletopenglsupport.a(DemoApplication.o): In function `DemoApplication::mouseFunc(int, int, int, int)':
DemoApplication.cpp:(.text+0x2dc3): undefined reference to `btPoint2PointConstraint::btPoint2PointConstraint(btRigidBody&, btVector3 const&)'

The command that I use to get the executable is:

g++ -o prueba main.cpp BasicDemo.o -I/usr/include/bullet/ -lGL -lglut -L/usr/lib/bullet -lbulletdynamics -lbulletmath -lbulletcollision -lbulletopenglsupport

I have all the bullet libs in /usr/lib/bullet and the header files in /usr/include/bullet.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Problem compiling examples

Post by Erwin Coumans »

inakin wrote: g++ -o prueba main.cpp BasicDemo.o -I/usr/include/bullet/ -lGL -lglut -L/usr/lib/bullet -lbulletdynamics -lbulletmath -lbulletcollision -lbulletopenglsupport
The compile order is important, and bulletopenglsupport uses bulletdynamics, so it should come first:

g++ -o prueba main.cpp BasicDemo.o -I/usr/include/bullet/ -lGL -lglut -L/usr/lib/bullet -lbulletopenglsupport -lbulletdynamics -lbulletcollision -lbulletmath

Hope this helps,
Erwin