Troubles compiling some code

Kalash
Posts: 4
Joined: Wed Dec 26, 2007 12:26 pm

Troubles compiling some code

Post by Kalash »

I have fuly compiled bullet using msvc and all seems to be find, I have libs, and examples working.

I tried to compile a small project but I have errors under codeblock:
CBulletObjectAnimator.cpp:: undefined reference to `btRigidBody::btRigidBody(float, btMotionState*, btCollisionShape*, btVector3 const&)'
CBulletObjectAnimator.cpp:: undefined reference to `btSphereShape::btSphereShape(float)'
obj\Release\include\Bullet\CBulletObjectAnimator.o(.rdata$_ZTV13btConvexShape[vtable for btConvexShape]+0x14):CBulletObjectAnimator.cpp:: undefined reference to `btCollisionShape::getBoundingSphere(btVector3&, float&) const'
obj\Release\include\Bullet\CBulletObjectAnimator.o(.rdata$_ZTV23btGImpactShapeInterface[vtable for btGImpactShapeInterface]+0x14):CBulletObjectAnimator.cpp:: undefined reference to `btCollisionShape::getBoundingSphere(btVector3&, float&) const'
CBulletPhysicsUtils.cpp:: undefined reference to `btConvexHullShape::btConvexHullShape(float const*, int, int)'
:: === Build finished: 5 errors, 0 warnings ===
I included the following libs:
libboxbox.lib
libbulletcollision.lib
libbulletdynamics.lib
libbulletmath.lib
libGIMPACT.lib
libGIMPACTUtils.lib
libconvexdecomposition.lib
libquicksteb.lib
What's wrong? Did I forgot something?
Thanks.
Kalash
Posts: 4
Joined: Wed Dec 26, 2007 12:26 pm

Re: Troubles compiling some code

Post by Kalash »

Ok, I searched help in the examples and I changed :
rigidBody = new btRigidBody((btScalar)mass,
motionState,
collisionShape,
localInertia
);
into :

Code: Select all

rigidBody = new btRigidBody(btRigidBody::btRigidBodyConstructionInfo(
    (btScalar)mass,
    motionState,
    collisionShape,
    localInertia)
  );
and one error disapeared.

The others still exists, the concerned code seems to be :

Code: Select all

btCollisionShape *collisionShape = new btSphereShape((btScalar)1.0f);
and

Code: Select all

btConvexHullShape* aConvexHullShape = new btConvexHullShape((btScalar*)&aBtVertBuffer[0], aBtVertBuffer.size());
(All the values mays be correct)
Ronin
Posts: 15
Joined: Fri Oct 06, 2006 9:36 am

Re: Troubles compiling some code

Post by Ronin »

Hi, I have a similar problem. I also included all libraries from the lib folder and I get the following linker errors:

Code: Select all

CPhysicsSimulatorBullet.obj : error LNK2019: unresolved external symbol "public: void __thiscall btRigidBody::setDamping(double,double)" (?setDamping@btRigidBody@@QAEXNN@Z) referenced in function "public: virtual class IPhysicsObject * __thiscall CPhysicsSimulatorBullet::createTriggerObject(int,class IEntity *,struct SShape &)" (?createTriggerObject@CPhysicsSimulatorBullet@@UAEPAVIPhysicsObject@@HPAVIEntity@@AAUSShape@@@Z)
CShapeConverterBullet.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btBoxShape::calculateLocalInertia(double,class btVector3 &)const " (?calculateLocalInertia@btBoxShape@@UBEXNAAVbtVector3@@@Z)
CShapeConverterBullet.obj : error LNK2001: unresolved external symbol "public: virtual double __thiscall btCollisionShape::getAngularMotionDisc(void)const " (?getAngularMotionDisc@btCollisionShape@@UBENXZ)
CShapeConverterBullet.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall btCollisionShape::getBoundingSphere(class btVector3 &,double &)const " (?getBoundingSphere@btCollisionShape@@UBEXAAVbtVector3@@AAN@Z)
.\..\bin/main.exe : fatal error LNK1120: 4 unresolved externals
I changed the constructor of btRigidBody accordingly to the previous post and that solved one problem, but this 4 unresolved externals still remain.

I cannot imagine what could be wrong with for example setDamping(double,double), I looked into the examples, but it seems that nothing has changed. I'm kinda stuck with this atm....

Any help appreciated, thanks,
Ronin

Edit: The errors occured with switching from Bullet 2.62 to 2.66 btw...
blt_nub
Posts: 1
Joined: Wed Jan 02, 2008 12:41 am

Re: Troubles compiling some code

Post by blt_nub »

I am using btRigidBody constructor like that

Code: Select all

rigidBody = new btRigidBody(mass,
    motionState,
    collisionShape,
    localInertia)
  );
but I got a fatal error "cannot open input file 'libboxbox.lib' ", I don't understand where is the problem
Kalash
Posts: 4
Joined: Wed Dec 26, 2007 12:26 pm

Re: Troubles compiling some code

Post by Kalash »

@blt_nub : Check your link to libboxbox.lib.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Troubles compiling some code

Post by Erwin Coumans »

Did you already figure out about the issue with codeblock? It is not clear what is going wrong.

Can you try to:
- clean and rebuild all libraries
- use CMake to generate Codeblock projectfiles, and use codeblock to build the libraries and application (instead of using msvc)

Hope this helps,
Erwin
Kalash
Posts: 4
Joined: Wed Dec 26, 2007 12:26 pm

Re: Troubles compiling some code

Post by Kalash »

I used CMake to create Makefile for MinGW but I can't compile, I've some errors:

Code: Select all

......................................................
Scanning dependencies of target LibGLUI
[ 19%] Building CXX object Extras/glui/CMakeFiles/LibGLUI.dir/glui_checkbox.obj
In file included from C:\Documents and Settings\Famille JACOB\Bureau\bullet-2.66
\Extras\glui\/GL/glui.h:54,
                 from C:\Documents and Settings\Famille JACOB\Bureau\bullet-2.66
\Extras\glui\/glui_internal_control.h:11,
                 from C:\Documents and Settings\Famille JACOB\Bureau\bullet-2.66
\Extras\glui\glui_checkbox.cpp:33:
C:/DOCUME~1/FAMILL~1/Bureau/bullet-2.66/glut/GL/glut.h:43: error: redeclaration
of C++ built-in type `short'
mingw32-make[2]: *** [Extras/glui/CMakeFiles/LibGLUI.dir/glui_checkbox.obj] Erro
r 1
mingw32-make[1]: *** [Extras/glui/CMakeFiles/LibGLUI.dir/all] Error 2
mingw32-make: *** [all] Error 2

C:\Documents and Settings\Famille JACOB\Bureau\bullet-2.66>
Thank you.