undefined reference to....

GameOn
Posts: 35
Joined: Mon Dec 27, 2010 10:46 pm

undefined reference to....

Post by GameOn »

Sorry for all these noobish questions, but here comes another one :

Q : While compiling an irrlicht/bullet demo code I got from scavanging these forums I'm having these particular errors that show up in the debugger as :

Code: Select all

-undefined reference to `btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(btStackAlloc*, btPoolAllocator*, btPoolAllocator*)'|

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

undefined reference to `btRigidBody::btRigidBody(float, btMotionState*, btCollisionShape*, btVector3 const&, float, float, float, float)'|

undefined reference to `btRigidBody::btRigidBody(float, btMotionState*, btCollisionShape*, btVector3 const&, float, float, float, float)'|

these debugging errors output are associated with the following lines of codes :
(theses lines aren't following each other in the code, there's a gap of 100 lines in one case)

Code: Select all

btDefaultCollisionConfiguration *CollisionConfiguration = new btDefaultCollisionConfiguration();
btBroadphaseInterface *BroadPhase = new btAxisSweep3(btVector3(-1000, -1000, -1000), btVector3(1000, 1000, 1000));
btRigidBody *RigidBody = new btRigidBody(TMass, MotionState, Shape, LocalInertia);
btRigidBody *RigidBody = new btRigidBody(TMass, MotionState, Shape, LocalInertia);

I've looked into the api and btRigidBody seem to be still there so I'm guess this isn't the problem...

idk if I forgot to include something, so far all I have included is :
(And it is included fine... AFAIK)

Code: Select all

#include <irrlicht/irrlicht.h>
#include <bullet/btBulletCollisionCommon.h>
#include <bullet/btBulletDynamicsCommon.h>
#include <cstdlib>
...also, there are a lot of other bt stuff that works just fine, such as "btBroadphaseInterface" and "btCollisionDispatcher"... so I really don't know what's going on with these 4 particular lines.


So yea...
If anyone have any clue on what can cause these "undefined" errors thanks for sharing them.
I'm not new to play with debugging issues, but this one really makes me clueless on how to solve it...

Any help is welcome.
OSasuke
Posts: 47
Joined: Tue Dec 09, 2008 10:12 am

Re: undefined reference to....

Post by OSasuke »

Did you linked the ".lib" or ".a" libraries.

Note that there is a specific order to these files.
GameOn
Posts: 35
Joined: Mon Dec 27, 2010 10:46 pm

Re: undefined reference to....

Post by GameOn »

Well, thanks you very much for your interest OSasuke.

First off, beside my incapacity at creating these .a files from the downloadable source of bullet, I did succeed to find a built version of bullet 2.76 specially for minGW, thanks to these forums.

The current linkage order (if I can name it like that) is as follow :

libIrrlicht.dll.a
(That is the lib used to load Irrlicht 3D rendering engine)

libbulletCollision.a
libbulletDynamic.a
libbulletMath.a

I just linked bullet's lib in alphabetical order, is there a more appropriate order I should use ?
lulzfish
Posts: 43
Joined: Mon Jan 03, 2011 4:26 pm

Re: undefined reference to....

Post by lulzfish »

The ordering shouldn't matter, but I have mine linked in Dynamics, Collision, then Math
GameOn
Posts: 35
Joined: Mon Dec 27, 2010 10:46 pm

Re: undefined reference to....

Post by GameOn »

Well.

looks like the ordering did matter.

I have no idea why I haven't tried that sooner, but it seem to have solved these "undefined" errors.

Now the Hello world example seem to print a simulation on the console (but don't print hello :/ )

I think I should be happy...

hem... "yay, it seem to works"
...haha

PS : the ordering is indeed to PUT THE DARN "libBulletDynamics.a" LIB ON TOP OF ALL BULLET LIBS !!!11!!!!

IE : Dynamics, Collision, then Math as lulzfish said

PS : thanks a lot lulzfish