I seem to be having trouble integrating bullet with an OpenGL application I have. I was looking through the user manual (on page 5) and on step 4 it says to include the bullet src folder and three libraries. I tried to link to those libraries and compile my application with a Makefile but it is giving me this:
------
make
g++ -DOGL_CASTS_USE_DOTS -DMAC_OS -g -o proj4 proj4.o Building.o Ground.o Vector.o Triangle.o BMPLoader.o Divide.o Pillar.o Roof.o MagicMaker.o Picture.o TexHandler.o Door.o TGAImageReader.o -L/usr/X11R6/lib -LbulletSrc/BulletDynamics -LbulletSrc/BulletCollision -LbulletSrc/LinearMath -framework OpenGL -framework GLUT -framework Foundation
/usr/bin/ld: Undefined symbols:
btAlignedFreeInternal(void*)
btAlignedAllocInternal(unsigned long, int)
btPolyhedralConvexShape::btPolyhedralConvexShape()
btCollisionShape::getBoundingSphere(btVector3&, float&) const
btCollisionShape::getAngularMotionDisc() const
typeinfo for btCollisionShape
vtable for btBoxShape
vtable for btCollisionShape
vtable for btConvexInternalShape
vtable for btPolyhedralConvexShape
collect2: ld returned 1 exit status
make: *** [proj4] Error 1
------
The error only appears when I make this call in my code (taken from the DemoApplication):
btCollisionShape* m_shootBoxShape = new btBoxShape(btVector3(0.5f,0.5f,0.5f));
I've tried running the demos and they run just fine, which leads me to believe I'm probably not including/linking to something I should be. I took the src directory from the bullet download and renamed it "bulletSrc" and put it in my application directory. I also linked to the BulletDynamics, BulletCollision, and LinearMath directories within the bullet src directory, which I assumed would cover the libraries I needed to include (but that may not be the case?). Here's a copy of my Makefile for reference:
Code: Select all
# name of executable file
PROG = proj4
# -DMAC_OS is a compiler variable we use to inform our code we're compiling with mac
CPP = g++ -DOGL_CASTS_USE_DOTS -DMAC_OS
# Include the bullet src folder
C_FLAGS = -g -c -IbulletSrc -I/usr/X11R6/include
# Link to the bullet and OpenGL libraries
LIB = -L/usr/X11R6/lib -LbulletSrc/BulletDynamics -LbulletSrc/BulletCollision -LbulletSrc/LinearMath
GRAPHICS_LIBRARIES = -framework OpenGL -framework GLUT -framework Foundation
# Our object files
OBJS = $(PROG).o Building.o Ground.o Vector.o Triangle.o BMPLoader.o Divide.o Pillar.o Roof.o MagicMaker.o Picture.o TexHandler.o Door.o TGAImageReader.o
$(PROG): $(OBJS)
$(CPP) -g -o $(PROG) $(OBJS) $(LIB) $(GRAPHICS_LIBRARIES)
$(PROG).o: $(PROG).cpp
$(CPP) $(C_FLAGS) $(PROG).cpp
Building.o: Building.cpp Building.h
$(CPP) $(C_FLAGS) Building.cpp
Ground.o: Ground.cpp Ground.h
$(CPP) $(C_FLAGS) Ground.cpp
Vector.o: Vector.cpp Vector.h
$(CPP) $(C_FLAGS) Vector.cpp
Triangle.o: Triangle.cpp Triangle.h
$(CPP) $(C_FLAGS) Triangle.cpp
BMPLoader.o: BMPLoader.cpp BMPLoader.h
$(CPP) $(C_FLAGS) BMPLoader.cpp
Divide.o: Divide.cpp Divide.h
$(CPP) $(C_FLAGS) Divide.cpp
Pillar.o: Pillar.cpp Pillar.h
$(CPP) $(C_FLAGS) Pillar.cpp
Roof.o: Roof.cpp Roof.h
$(CPP) $(C_FLAGS) Roof.cpp
MagicMaker.o: MagicMaker.cpp MagicMaker.h
$(CPP) $(C_FLAGS) MagicMaker.cpp
Picture.o: Picture.cpp Picture.h
$(CPP) $(C_FLAGS) Picture.cpp
TexHandler.o: TexHandler.cpp TexHandler.h
$(CPP) $(C_FLAGS) TexHandler.cpp
Door.o: Door.cpp Door.h
$(CPP) $(C_FLAGS) Door.cpp
TGAImageReader.o: TGAImageReader.cpp TGAImageReader.h
$(CPP) $(C_FLAGS) TGAImageReader.cpp
Thanks,
Mika