compilation problem

rodrigoml
Posts: 5
Joined: Fri Jan 21, 2011 12:58 am
Location: argentina

compilation problem

Post by rodrigoml »

hello, I m starting with bullet, so I try to compile the basicdemo from bullet demos, after a successful compilation of the helloworld demo, and gave this:

rodri@dora:~/Escritorio/temporal/BasicDemo$ g++ main.cpp Win32BasicDemo.cpp BasicDemo.cpp -lGL -lGLU -I ./OpenGL -I ./bullet/ ./bullet/BulletDynamics/libBulletDynamics.a ./bullet/BulletCollision/libBulletCollision.a ./bullet/LinearMath/libLinearMath.a
/tmp/ccvfVBOT.o: In function `main':
main.cpp:(.text+0x19): undefined reference to `GLDebugDrawer::GLDebugDrawer()'
main.cpp:(.text+0x2ce): undefined reference to `glutmain(int, char**, int, int, char const*, DemoApplication*)'
/tmp/ccvfVBOT.o: In function `GlutDemoApplication::GlutDemoApplication()':
main.cpp:(.text._ZN19GlutDemoApplicationC2Ev[GlutDemoApplication::GlutDemoApplication()]+0xd): undefined reference to `DemoApplication::DemoApplication()'
main.cpp:(.text._ZN19GlutDemoApplicationC2Ev[GlutDemoApplication::GlutDemoApplication()]+0x16): undefined reference to `vtable for GlutDemoApplication'
/tmp/ccvfVBOT.o: In function `GlutDemoApplication::~GlutDemoApplication()':
main.cpp:(.text._ZN19GlutDemoApplicationD2Ev[GlutDemoApplication::~GlutDemoApplication()]+0xb): undefined reference to `vtable for GlutDemoApplication'
main.cpp:(.text._ZN19GlutDemoApplicationD2Ev[GlutDemoApplication::~GlutDemoApplication()]+0x16): undefined reference to `DemoApplication::~DemoApplication()'
/tmp/ccvfVBOT.o: In function `GLDebugDrawer::~GLDebugDrawer()':
main.cpp:(.text._ZN13GLDebugDrawerD1Ev[GLDebugDrawer::~GLDebugDrawer()]+0xb): undefined reference to `vtable for GLDebugDrawer'
/tmp/ccU06RNI.o: In function `BasicDemo::initPhysics()':
BasicDemo.cpp:(.text+0x148): undefined reference to `DemoApplication::setCameraDistance(float)'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x18): undefined reference to `DemoApplication::myinit()'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x1c): undefined reference to `DemoApplication::updateCamera()'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x24): undefined reference to `DemoApplication::clientResetScene()'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x28): undefined reference to `DemoApplication::setShootBoxShape()'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x2c): undefined reference to `DemoApplication::shootBox(btVector3 const&)'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x30): undefined reference to `DemoApplication::keyboardCallback(unsigned char, int, int)'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x38): undefined reference to `GlutDemoApplication::specialKeyboard(int, int, int)'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x40): undefined reference to `DemoApplication::reshape(int, int)'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x44): undefined reference to `DemoApplication::mouseFunc(int, int, int, int)'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x48): undefined reference to `DemoApplication::mouseMotionFunc(int, int)'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x50): undefined reference to `DemoApplication::renderme()'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x54): undefined reference to `GlutDemoApplication::swapBuffers()'
/tmp/ccU06RNI.o:(.rodata._ZTV9BasicDemo[vtable for BasicDemo]+0x58): undefined reference to `GlutDemoApplication::updateModifierKeys()'
/tmp/ccU06RNI.o:(.rodata._ZTI9BasicDemo[typeinfo for BasicDemo]+0x8): undefined reference to `typeinfo for GlutDemoApplication'
collect2: ld returned 1 exit status


as you see, I m using as static library the bullet and OpenGL (a folder from the bullet demos folder with a set of librarys that use this demo). It should work.. any suggestion?
thanks
Rommel
Posts: 4
Joined: Sat Jan 22, 2011 8:27 am

Re: compilation problem

Post by Rommel »

You may not have linked glut in your compilation, try adding -lglut to your compilation line. Let me know by PM if it still fails.
If you check the errors, it is obvious that you are missing glut linkage.

If your system doesn't have glut: sudo apt-get install freeglut3-dev

---- edit

This is the generated cmake build line. You may want to investigate using cmake, it should have auto - built the demos for you.

Code: Select all

/usr/bin/c++   -O3 -DNDEBUG   CMakeFiles/AppAllBulletDemos.dir/Main.o CMakeFiles/AppAllBulletDemos.dir/DemoEntries.o CMakeFiles/AppAllBulletDemos.dir/__/CcdPhysicsDemo/CcdPhysicsDemo.o CMakeFiles/AppAllBulletDemos.dir/__/BasicDemo/BasicDemo.o CMakeFiles/AppAllBulletDemos.dir/__/BspDemo/BspDemo.o CMakeFiles/AppAllBulletDemos.dir/__/BspDemo/BspConverter.o CMakeFiles/AppAllBulletDemos.dir/__/BspDemo/BspLoader.o CMakeFiles/AppAllBulletDemos.dir/__/DynamicControlDemo/MotorDemo.o CMakeFiles/AppAllBulletDemos.dir/__/ConcaveDemo/ConcavePhysicsDemo.o CMakeFiles/AppAllBulletDemos.dir/__/ConcaveRaycastDemo/ConcaveRaycastDemo.o CMakeFiles/AppAllBulletDemos.dir/__/ConcaveConvexcastDemo/ConcaveConvexcastDemo.o CMakeFiles/AppAllBulletDemos.dir/__/ConvexDecompositionDemo/ConvexDecompositionDemo.o CMakeFiles/AppAllBulletDemos.dir/__/SliderConstraintDemo/SliderConstraintDemo.o CMakeFiles/AppAllBulletDemos.dir/__/RagdollDemo/RagdollDemo.o CMakeFiles/AppAllBulletDemos.dir/__/GimpactTestDemo/GimpactTestDemo.o CMakeFiles/AppAllBulletDemos.dir/__/Raytracer/Raytracer.o CMakeFiles/AppAllBulletDemos.dir/__/GjkConvexCastDemo/LinearConvexCastDemo.o CMakeFiles/AppAllBulletDemos.dir/__/ForkLiftDemo/ForkLiftDemo.o CMakeFiles/AppAllBulletDemos.dir/__/SoftDemo/SoftDemo.o CMakeFiles/AppAllBulletDemos.dir/__/ConstraintDemo/ConstraintDemo.o CMakeFiles/AppAllBulletDemos.dir/__/Benchmarks/BenchmarkDemo.o CMakeFiles/AppAllBulletDemos.dir/__/Box2dDemo/Box2dDemo.o  -o AppAllBulletDemos -rdynamic ../../Extras/glui/libGLUI.a ../../Extras/GIMPACTUtils/libGIMPACTUtils.a ../../Extras/ConvexDecomposition/libConvexDecomposition.a ../../src/BulletMultiThreaded/libBulletMultiThreaded.a ../OpenGL/libOpenGLSupport.a ../../Extras/Serialize/BulletWorldImporter/libBulletWorldImporter.a ../../src/BulletSoftBody/libBulletSoftBody.a ../../src/BulletDynamics/libBulletDynamics.a ../../src/BulletCollision/libBulletCollision.a ../../Extras/Serialize/BulletFileLoader/libBulletFileLoader.a ../../src/LinearMath/libLinearMath.a -lglut -lGL -lGLU