Bullet compile and Hello World

tdc
Posts: 3
Joined: Sun Sep 16, 2012 8:14 pm

Bullet compile and Hello World

Post by tdc »

Hi,
I'm really new to the Bullet Engine and I have a few basic questions about how to set it up.
Firstly I compiled it like discribed in the wiki. (http://www.bulletphysics.org/mediawiki- ... ary_Recipe)
The result of that was a dir with several makefiles and the *.so-files. Now, I want to compile the Hello-World-Program using the .so-files so I copied them to the place, where my hello.cpp is and compiled everything using:

Code: Select all

g++ -fPIC -shared -I/usr/local/java/include -I/usr/local/java/include/genunix hello.cpp -o libhello.so -lBulletCollision -lBulletDynamics -lBulletMultiThreaded -lBulletSoftBody -lLinearMath -lMiniCL
(These strange Java-Paths are there due to the fact that I want to try using the native Bullet engine over Java with JNI later - I know that there is JBullet, but just want to try this and they don't cause the errors)
Using this I get:
hello.cpp:2:36: schwerwiegender Fehler: btBulletDynamicsCommon.h: Datei oder Verzeichnis nicht gefunden
The compiler can't find btBulletDynamicsCommon.h. Why? Isn't it included in one of the *.so? Does it even makes sense/does it work to make a *.so-file that uses a *.so-file?
How do I compile the Hello-World-Example using the *.so-files?
(Propably my questions are totally stupid but I havn't worked that much with C++ and *.so-files yet :oops: )
mobeen
Posts: 122
Joined: Thu May 05, 2011 11:47 am

Re: Bullet compile and Hello World

Post by mobeen »

You need to provide the include directory containing the required header to the compiler. I have not worked on linux and g++ so I cant help on how to go about it but you can try google to see how to set this up in your compiler. (You need to provide another option like -I/[BULLET_ROOT]\src i think where BULLET_ROOT is where you unzipped the bullet sdk)

As far as I know, .so files are like Windows dlls. They only contain definitions, the headers are needed so that the linker can know what the function accepts as its arguments and what it returns.

Hope this helps.
Regards,
Mobeen
tdc
Posts: 3
Joined: Sun Sep 16, 2012 8:14 pm

Re: Bullet compile and Hello World

Post by tdc »

Thank you.
Compiling works now:

Code: Select all

gcc -fPIC -shared -I/home/path/bullet-2.80-rev2531/src -I/usr/local/java/include -I/usr/local/java/include/genunix hello.cpp -o libhello.so -LBulletCollision -LBulletDynamics -LBulletMultiThreaded -LBulletSoftBody -LLinearMath -LMiniCL
(Now i still get an Error but this is because of JNI but I (hopefully) will get it fixed somehow)