Trouble compiling with MinGW

cchewif

15-08-2007 18:45:23

Hi,

I'm having trouble compiling with MinGW + bullet 2.55

Here 's the message :


ogrebullet\Dynamics\src\Constraints\OgreBulletDynamicsHingeConstraint.cpp:: In constructor `OgreBulletDynamics::HingeConstraint::HingeConstraint(OgreBulletDynamics::RigidBody*, OgreBulletDynamics::RigidBody*, const Ogre::Vector3&, const Ogre::Vector3&, const Ogre::Vector3&, const Ogre::Vector3&)':
ogrebullet\Dynamics\src\Constraints\OgreBulletDynamicsHingeConstraint.cpp:58:error: no matching function for call to `btHingeConstraint::btHingeConstraint(btRigidBody&, btRigidBody&, btVector3, btVector3, btVector3, btVector3)'

[...]
candidates are :
[...]
btHingeConstraint::btHingeConstraint(btRigidBody&, btRigidBody&, const btVector3&, const btVector3&, btVector3&, btVector3&)


This happens in

mConstraint = new btHingeConstraint(
*rbA->getBulletRigidBody (),
*rbB->getBulletRigidBody (),
OgreBulletCollisions::OgreBtConverter::to(pivotInA),
OgreBulletCollisions::OgreBtConverter::to(pivotInB),
OgreBulletCollisions::OgreBtConverter::to(axisInA),
OgreBulletCollisions::OgreBtConverter::to(axisInB)
and other places in the code.

The problem seems to be that the variables returned by the converter are declared const by the compiler, because they are temporary. At first I thought MS Vc++ might automaticaly do something, but I have read in this forum that people have managed building OgreBullet on linux. So I have no idea where the problem might be.

I could always work around the problem and copy the converter's results before passing them to the constructor, but I'm not sure that would be clean.
I'm still bothered by the fact the two last arguments for the constructor are not const, especially since the bullet code shows that the constructor only calls copy constructors on those two btVector3.

What should be done ? :oops:

rti

16-08-2007 21:16:28

I am sitting on OS X (gcc 4.0.1) and to get it to compile, it just did exactly what you mentioned:

From OgreBulletDynamicsHingeConstraint.cpp:// -------------------------------------------------------------------------
HingeConstraint::HingeConstraint(RigidBody * rbA, RigidBody * rbB, const Vector3& pivotInA,
const Vector3& pivotInB, const Vector3& axisInA, const Vector3& axisInB):
TypedConstraint(rbA, rbB)
{
btVector3 vec[4];
vec[0] = OgreBulletCollisions::OgreBtConverter::to(pivotInA);
vec[1] = OgreBulletCollisions::OgreBtConverter::to(pivotInB);
vec[2] = OgreBulletCollisions::OgreBtConverter::to(axisInA);
vec[3] = OgreBulletCollisions::OgreBtConverter::to(axisInB);

mConstraint = new btHingeConstraint(
*rbA->getBulletRigidBody (),
*rbB->getBulletRigidBody (),
vec[0], vec[1], vec[2], vec[3]);
}
// -------------------------------------------------------------------------
HingeConstraint::HingeConstraint(RigidBody * rbA,
const Vector3& pivotInA,
const Vector3& axisInA):
TypedConstraint(rbA)
{
btVector3 vec[2];
vec[0] = OgreBulletCollisions::OgreBtConverter::to(pivotInA);
vec[1] = OgreBulletCollisions::OgreBtConverter::to(axisInA);

mConstraint = new btHingeConstraint(*rbA->getBulletRigidBody (),
vec[0], vec[1]);
}


But i must admit, that i did not test it until now... :oops:

cheers

rti

03-09-2007 10:21:49

now i tested it and the patch works fine.