Linking with Bullet compiled with MinGW G++

pianoman
Posts: 2
Joined: Tue Dec 09, 2008 1:30 am

Linking with Bullet compiled with MinGW G++

Post by pianoman »

Congrats on a superb physics library! Great features, easy-to-use API, good documentation. Thanks for sharing it.

I intend to use Bullet under Windows with Eclipse and MinGW. I created an Eclipse project/make files with CMake, then compiled the library. It compiled great (except for a couple of GLUT dependency problems in the fork lift demo, possibly due to my system's GLUT setup). But then when I link my own code to the libraries, I get "unresolved symbol" errors on CProfileManager::Start_Profile and CProfileManager::Stop_Profile, like the following:

C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../libBulletDynamics.a(btSequentialImpulseConstraintSolver.obj):btSequentialImpulseConstraintSolver.cpp:(.text+0xc10): undefined reference to `CProfileManager::Start_Profile(char const*)'

(I verified that the btQuickprof.obj was successfully generated, that the object file's name was present in the libLinearMath.a library file, and that the Start_Profile and Stop_Profile symbols were there as well.) Any ideas why I might be getting these linker errors?

Thanks.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Linking with Bullet compiled with MinGW G++

Post by Erwin Coumans »

Do you link against the libraries in the right order?

libbulletsoftbody , libbulletdynamics, libbulletcollision, libbulletmath.

Alternatively, you can switch off the profiling by defining -DBT_NO_PROFILE, or edit and enable the line in Bullet/src/LinearMath/btQuickprof.h

Hope this helps,
Erwin
pianoman
Posts: 2
Joined: Tue Dec 09, 2008 1:30 am

Re: Linking with Bullet compiled with MinGW G++

Post by pianoman »

Indeed, it was the order in which the libraries were linked that was the problem, as you pointed out! (Bold-ed so others can find the solution faster than I did :) ) It compiles and links without errors now. I never knew that gcc cared about the order in which you link libraries (my excuse is that i'm more experienced with MSVC 6.0 which I just moved from).

Thanks a bunch!
Joel
esingla
Posts: 8
Joined: Sat Mar 13, 2010 8:00 am

Re: Linking with Bullet compiled with MinGW G++

Post by esingla »

Thanks to both of you for this discussion. I got my solution, as I was getting this problem due to different order.