Error in compilation

Ehsanizadi
Posts: 72
Joined: Mon Dec 02, 2013 4:13 pm

Error in compilation

Post by Ehsanizadi »

Hey,

I am very new to Bullet (a few hours!, version 2.82), linux (I am using Ubuntu 13.10) and programming!
I just installed Bullet physics on my ubuntu.

I tried to compile the Helloworld example using this command in the shell:

Code: Select all

g++ *.cpp -lSDL -lGL -lGLU -lSDL_image -lBulletSoftBody -lBulletDynamics -lBulletCollision -lLinearMath -I/usr/include/bullet/

but I get this error:

Code: Select all

/usr/bin/ld: cannot find -lSDL
/usr/bin/ld: cannot find -lSDL_image
collect2: error: ld returned 1 exit status
Any suggestion? Ideas?

Thank you in advance
Ehsan
User avatar
nullChar
Posts: 10
Joined: Fri Jan 25, 2013 1:51 pm

Re: Error in compilation

Post by nullChar »

This isn't really a Bullet build issue, but a dependencies problem. You're trying to link the SDL and SDL_image libraries, but they don't exist on your machine.
Find the library files for SDL and place them within your library directories and it should link correctly.
Ehsanizadi
Posts: 72
Joined: Mon Dec 02, 2013 4:13 pm

Re: Error in compilation

Post by Ehsanizadi »

nullChar wrote:This isn't really a Bullet build issue, but a dependencies problem. You're trying to link the SDL and SDL_image libraries, but they don't exist on your machine.
Find the library files for SDL and place them within your library directories and it should link correctly.

Thanks
Ehsanizadi
Posts: 72
Joined: Mon Dec 02, 2013 4:13 pm

Re: Error in compilation

Post by Ehsanizadi »

I installed the libraries now I get another error:

Code: Select all

/tmp/ccuXddiJ.o: In function `main':
main.cpp:(.text+0x61): undefined reference to `glutmain(int, char**, int, int, char const*, DemoApplication*)'
/tmp/ccuXddiJ.o: In function `GlutDemoApplication::GlutDemoApplication()':
main.cpp:(.text._ZN19GlutDemoApplicationC2Ev[_ZN19GlutDemoApplicationC5Ev]+0x14): undefined reference to `DemoApplication::DemoApplication()'
main.cpp:(.text._ZN19GlutDemoApplicationC2Ev[_ZN19GlutDemoApplicationC5Ev]+0x1f): undefined reference to `vtable for GlutDemoApplication'
/tmp/ccuXddiJ.o: In function `GlutDemoApplication::~GlutDemoApplication()':
main.cpp:(.text._ZN19GlutDemoApplicationD2Ev[_ZN19GlutDemoApplicationD5Ev]+0x13): undefined reference to `vtable for GlutDemoApplication'
main.cpp:(.text._ZN19GlutDemoApplicationD2Ev[_ZN19GlutDemoApplicationD5Ev]+0x1f): undefined reference to `DemoApplication::~DemoApplication()'
/tmp/ccwCkgN9.o: In function `VoronoiFractureDemo::keyboardCallback(unsigned char, int, int)':
VoronoiFractureDemo.cpp:(.text+0x791): undefined reference to `DemoApplication::keyboardCallback(unsigned char, int, int)'
/tmp/ccwCkgN9.o: In function `VoronoiFractureDemo::initPhysics()':
VoronoiFractureDemo.cpp:(.text+0x3321): undefined reference to `DemoApplication::setCameraDistance(float)'
/tmp/ccwCkgN9.o: In function `__static_initialization_and_destruction_0(int, int)':
VoronoiFractureDemo.cpp:(.text+0x455d): undefined reference to `GLDebugDrawer::GLDebugDrawer()'
VoronoiFractureDemo.cpp:(.text+0x456c): undefined reference to `GLDebugDrawer::~GLDebugDrawer()'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0x10): undefined reference to `DemoApplication::removePickingConstraint()'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0x18): undefined reference to `DemoApplication::pickObject(btVector3 const&, btCollisionObject const*)'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0x40): undefined reference to `DemoApplication::myinit()'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0x48): undefined reference to `DemoApplication::updateCamera()'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0x60): undefined reference to `DemoApplication::setShootBoxShape()'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0x68): undefined reference to `DemoApplication::shootBox(btVector3 const&)'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0x80): undefined reference to `GlutDemoApplication::specialKeyboard(int, int, int)'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0x90): undefined reference to `DemoApplication::reshape(int, int)'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0x98): undefined reference to `DemoApplication::mouseFunc(int, int, int, int)'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0xa0): undefined reference to `DemoApplication::mouseMotionFunc(int, int)'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0xb0): undefined reference to `DemoApplication::renderme()'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0xb8): undefined reference to `GlutDemoApplication::swapBuffers()'
/tmp/ccwCkgN9.o:(.rodata._ZTV19VoronoiFractureDemo[_ZTV19VoronoiFractureDemo]+0xc0): undefined reference to `GlutDemoApplication::updateModifierKeys()'
/tmp/ccwCkgN9.o:(.rodata._ZTI19VoronoiFractureDemo[_ZTI19VoronoiFractureDemo]+0x10): undefined reference to `typeinfo for GlutDemoApplication'
collect2: error: ld returned 1 exit status
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Error in compilation

Post by Erwin Coumans »

Bullet doesn't use SDL. You forgot to add the OpenGLSupport library.

You better use a build system that ships with Bullet, such as premake or cmake. It should compile out-of-the-box. See the instructions in the docs folder.
Ehsanizadi
Posts: 72
Joined: Mon Dec 02, 2013 4:13 pm

Re: Error in compilation

Post by Ehsanizadi »

Erwin Coumans wrote:Bullet doesn't use SDL. You forgot to add the OpenGLSupport library.

You better use a build system that ships with Bullet, such as premake or cmake. It should compile out-of-the-box. See the instructions in the docs folder.
How to add OpenGLSupport library in the command I should type? (where should it be written?) If possible, could you please write the whole command should be typed in shell to run a code?
PS: I used Cmake to install bullet.