[solved] compiling programs with OpenGL

humanoid
Posts: 3
Joined: Mon Dec 27, 2010 7:01 am

[solved] compiling programs with OpenGL

Post by humanoid »

Hello all,

I am very new to Bullet (and C programming in general). I would like to build a virtual environment and display it in the same way that the Demos show.

I downloaded, compiled, and installed version 2.77. Bullet itself seems fine. I can run

Code: Select all

[humanoid2050@blackbox HelloWorld]$ g++ -I ~/Downloads/bullet-2.77/src/ -l BulletDynamics -l BulletCollision -l LinearMath HelloWorld.cpp 
and it compiles and runs with no problems.

The BasicDemo yields this however

Code: Select all

[humanoid2050@blackbox BasicDemo]$ g++ -I ~/Downloads/bullet-2.77/src/ -l BulletDynamics -l BulletCollision -l LinearMath BasicDemo.cpp 
In file included from BasicDemo.cpp:32:0:
BasicDemo.h:22:33: fatal error: GlutDemoApplication.h: No such file or directory
compilation terminated.
Including the directory with the GlutDemoApplication.h yields this

Code: Select all

[humanoid2050@blackbox BasicDemo]$ g++ -I ~/Downloads/bullet-2.77/src/ -I ~/Downloads/bullet-2.77/Demos/OpenGL/ -l BulletDynamics -l BulletCollision -l LinearMath main.cpp 
/tmp/ccwqFaZA.o: In function `main':
main.cpp:(.text+0x18): undefined reference to `GLDebugDrawer::GLDebugDrawer()'
main.cpp:(.text+0x278): undefined reference to `BasicDemo::initPhysics()'
main.cpp:(.text+0x2cd): undefined reference to `glutmain(int, char**, int, int, char const*, DemoApplication*)'
/tmp/ccwqFaZA.o: In function `GlutDemoApplication::GlutDemoApplication()':
main.cpp:(.text._ZN19GlutDemoApplicationC2Ev[_ZN19GlutDemoApplicationC5Ev]+0xd): undefined reference to `DemoApplication::DemoApplication()'
main.cpp:(.text._ZN19GlutDemoApplicationC2Ev[_ZN19GlutDemoApplicationC5Ev]+0x16): undefined reference to `vtable for GlutDemoApplication'
/tmp/ccwqFaZA.o: In function `GlutDemoApplication::~GlutDemoApplication()':
main.cpp:(.text._ZN19GlutDemoApplicationD2Ev[_ZN19GlutDemoApplicationD5Ev]+0xb): undefined reference to `vtable for GlutDemoApplication'
main.cpp:(.text._ZN19GlutDemoApplicationD2Ev[_ZN19GlutDemoApplicationD5Ev]+0x16): undefined reference to `DemoApplication::~DemoApplication()'
/tmp/ccwqFaZA.o: In function `BasicDemo::BasicDemo()':
main.cpp:(.text._ZN9BasicDemoC2Ev[_ZN9BasicDemoC5Ev]+0x17): undefined reference to `vtable for BasicDemo'
/tmp/ccwqFaZA.o: In function `BasicDemo::~BasicDemo()':
main.cpp:(.text._ZN9BasicDemoD2Ev[_ZN9BasicDemoD5Ev]+0xc): undefined reference to `vtable for BasicDemo'
main.cpp:(.text._ZN9BasicDemoD2Ev[_ZN9BasicDemoD5Ev]+0x17): undefined reference to `BasicDemo::exitPhysics()'
/tmp/ccwqFaZA.o: In function `GLDebugDrawer::~GLDebugDrawer()':
main.cpp:(.text._ZN13GLDebugDrawerD2Ev[_ZN13GLDebugDrawerD5Ev]+0xb): undefined reference to `vtable for GLDebugDrawer'
collect2: ld returned 1 exit status
The program works fine using cmake, make, make install, but I need to be able to do this with compiler arguments if it can indeed be done.
I realize this is probably a simple question if you already know the answer, but I am stumped. Any help would be appreciated.
Last edited by humanoid on Wed Dec 29, 2010 12:37 am, edited 1 time in total.
humanoid
Posts: 3
Joined: Mon Dec 27, 2010 7:01 am

Re: compiling programs with OpenGL

Post by humanoid »

Perhaps I am the only one who needs to know, but just in case others are wondering I got the demos to compile with the following command

Code: Select all

g++ -I ~/Downloads/bullet-2.77/src/ -I ~/Downloads/bullet-2.77/Demos/OpenGL -lGL -lGLU -L ~/Downloads/bullet-2.77/Demos/OpenGL/ -l OpenGLSupport -lBulletDynamics -l BulletCollision -l LinearMath main.cpp RagdollDemo.cpp 
Obviously main.cpp and RagdollDemo.cpp should be replaced by the .cpp files for the demo you are currently compiling.

Cheers!