Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Hello World...
PostPosted: Tue Jun 23, 2009 6:48 pm 
Offline
User avatar

Joined: Fri Apr 17, 2009 4:12 pm
Posts: 11
Location: europe
Hi there!

I'm interested in programming using the bulletphysics library. While doing the first steps I was trying to run the "HelloWorld" program from the website (http://www.bulletphysics.com/mediawiki-1.5.8/index.php?title=Hello_World). Unfortunately I got some errors like:

Quote:
undefined reference to 'btAxisSweep3::btAxisSweep3(btVector3 const&, btVector3 const&, unsigned short, btOverlappingPairCache*, bool)'


First I thought that there is a linker problem and so I checked the paths of correctness (the files are in the concerning directories and I could open them!). Then I found out that the code looks like:

Code:
#include <btBulletDynamicsCommon.h>

int main (void)
{

        btVector3 worldAabbMin(-10000,-10000,-10000);
        btVector3 worldAabbMax(10000,10000,10000);
        int maxProxies = 1024;
        btAxisSweep3* broadphase = new btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies);

        ...



for me it looks like the btAxisSweep3 - constructor is not appropriate...?!
[btAxisSweep3(worldAabbMin,worldAabbMax,maxProxies) vs btAxisSweep3(btVector3 const&, btVector3 const&, unsigned short, btOverlappingPairCache*, bool)]
source: http://www.bulletphysics.com/Bullet/BulletFull/classbtAxisSweep3.html
Please correct me if I am wrong!

I tried to correct the implementation but was stumbling over the btOverlappingPairCache... it has no constructor - virtual function...

Hope anyone could give me a hint about that all!

Thanks
Leo


Top
 Profile  
 
 Post subject: Re: Hello World...
PostPosted: Wed Jun 24, 2009 7:31 am 
Offline

Joined: Fri Dec 19, 2008 2:51 pm
Posts: 32
Quote:
btAxisSweep3(const btVector3& worldAabbMin,const btVector3& worldAabbMax, unsigned short int maxHandles = 16384, btOverlappingPairCache* pairCache = 0, bool disableRaycastAccelerator = false)

The btAxisSweep3 construcot uses default arguments, so you don't have to specify the last ones. Your code should thus work fine (after all, it compiles successfully, and only the linking fails)

Are you sure you added the bullet libraries to your project?


Top
 Profile  
 
 Post subject: Re: Hello World...
PostPosted: Wed Jun 24, 2009 10:24 am 
Offline
User avatar

Joined: Fri Apr 17, 2009 4:12 pm
Posts: 11
Location: europe
Hi Dominik,

thanks for your reply! Good argument with the compilation....
Concerning the linked libraries: I include (as default in the HelloWorld) btBulletDynamicsCommon.h file in which the rest of the includes for all the other .h files is defined. As far as I understand it there is no need to include these pathes explicitly - correct me if I'm wrong.

I even tried to include the path to the btAxisSweep.h file ... but still I got the error. Does it mean that the file could not be read? Or would it cause another error? Sorry I'm not so common with C/C++ things....

Another thing I recognised was that the directory bullet-2.73/lib/ is empty with the exception of a readme file. Shouldn't there be some files in like bulletmath.a, bulletcollision.a, bulletdynamics.a...?

Cheers Leo


Top
 Profile  
 
 Post subject: Re: Hello World...
PostPosted: Wed Jun 24, 2009 11:33 am 
Offline

Joined: Fri Dec 19, 2008 2:51 pm
Posts: 32
if you use #include <*.h>, you do not use a library. In the header files, there are only declarations, while the libraries include the actual definitions (the stuff in the .cpp-files). So, you have to tell your application to use the bullet libraries (which is done during linking, when the compiler tries to resolve the function calls that were declared in included .h-files).

For this, you need the bullet libraries, which you get by building bullet. If your bullet/lib/ directory doesn't contain them after successfully building bullet, check the build directories, and copy the required files to the lib directory.

To tell the compiler to link the libraries when building bullet, you have to add them to the linker (windows/msvc) or add the necessary tags to the makefile (linux/gcc), If you need help on this, google can probably help you :)


Top
 Profile  
 
 Post subject: Re: Hello World...
PostPosted: Thu Jun 25, 2009 6:23 pm 
Offline
User avatar

Joined: Fri Apr 17, 2009 4:12 pm
Posts: 11
Location: europe
Hi Dominik,

I rebuilt the bullet library (version 2.74) on my Kubuntu 8.10 (I did as described here: http://bulletphysics.com/Bullet/BulletP ... c223854819).

    cmake . –G “Unix Makefiles”
    ./autogen.sh
    ./configure
    make

    include path: bullet/src
    library path: bullet/src/.libs
    linked libs: libbulletdynamics, libbulletcollision, libbulletmath

Still the /bullet/lib/ folder is empty... but I found the libbulletdynamics, libbulletcollision, libbulletmath libraries in the bullet/src/.libs. Unfortunately there is still a (or a new) problem with the linker:

Code:
Building target: TestBullet
Invoking: GCC C++ Linker
g++ -L/home/phmathys/bullet-2.74/src/.libs -o"TestBullet"  ./src/HelloWorld.o   -llibbulletdynamics -llibbulletcollision -llibbulletmath
/usr/bin/ld: cannot find -llibbulletdynamics
collect2: ld returned 1 exit status
make: *** [TestBullet] Error 1
make: Target `all' not remade because of errors.
Build complete for project TestBullet


I don't understand why the libraries cannot be found! And what has the /usr/bin/ld to do with this problem?

Cheers Philipp


Top
 Profile  
 
 Post subject: Re: Hello World...
PostPosted: Fri Jun 26, 2009 2:39 pm 
Offline

Joined: Fri Apr 10, 2009 6:44 pm
Posts: 17
use -lbulletdynamics instead of -libbulletdynamics

same with the other libs

Don't forget to add library paths (-L option I believe) pointing to all folders where your compiled bullet libraries are located


Top
 Profile  
 
 Post subject: Re: Hello World...
PostPosted: Wed Aug 05, 2009 3:02 pm 
Offline
User avatar

Joined: Fri Apr 17, 2009 4:12 pm
Posts: 11
Location: europe
Problem solved... I had an error while installing and did not see it...
Cheers Leo


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group