Qt and Bullet linking problem

Marcell
Posts: 14
Joined: Fri Oct 19, 2012 8:58 am

Qt and Bullet linking problem

Post by Marcell »

Hello!

I'm struggling with a linker error. I don't fully understand the problem and I'm out of ideas what else to try. Can someone please give advice?

The problem looks like this. I moved a Qt / Bullet Physics project to a new Win7 64 bit PC. Before I was developing it on a 32 bit Win7. The project compiles nicely there and runs without problems. I use the same Qt version 2010.05 on the new PC and I used the MinGW 4.4.0 that comes with it to compile the Bullet Physics library that is linked to my project. But when I build the project, I get linker errors like this:
./release\Joint.o:Joint.cpp:(.text+0x22e7): undefined reference to `btRigidBody::btRigidBody(float, btMotionState*, btCollisionShape*, btVector3 const&)'
./release\GroundPlane.o:GroundPlane.cpp:(.text+0x246): undefined reference to `btStaticPlaneShape::btStaticPlaneShape(btVector3 const&, float)'
The corresponding lines in the source look like this:

Code: Select all

btRigidBody rigidBody = new btRigidBody(mass, &motionState, collisionShape, inertia);
btCollisionShape collisionShape = new btStaticPlaneShape(btVector3(0, 0, 1), 0);
I don't think the problem is in the source though, since it compiles and links perfectly fine on the 32 bit system. And it's not like every call to the Bullet library produces a linker error. Only a very few pop up and strangely, all of them have a float parameter, where actually a btScalar should be used. The main difference between the old and new environment is the bitness, so I suspect that the problem may be coming from there, but I have no idea what exactly it could be. Any ideas where to dig next?

Thanks,
Marcell
Marcell
Posts: 14
Joined: Fri Oct 19, 2012 8:58 am

Re: Qt and Bullet linking problem

Post by Marcell »

I believe I have found the source of the problem. I compiled the Bullet library with the USE_DOUBLE_PRECISION flag set, but apparently all btScalar instances have been declared to be of type float due to a missing BT_USE_DOUBLE_PRECISION define in the source code. I was not aware of the fact that I have to set this define manually and it cost me days to figure this out.
jrandom
Posts: 5
Joined: Wed Jan 01, 2014 11:22 pm

Re: Qt and Bullet linking problem

Post by jrandom »

Marcell wrote:I believe I have found the source of the problem. I compiled the Bullet library with the USE_DOUBLE_PRECISION flag set, but apparently all btScalar instances have been declared to be of type float due to a missing BT_USE_DOUBLE_PRECISION define in the source code. I was not aware of the fact that I have to set this define manually and it cost me days to figure this out.
I'd been pulling my hair out for a few days over this very issue. Looks like I figured it out about the same time you did.