Errors while trying to build Box2D r254

To get one thing out of the way: I downloaded and built the Box2D 2.2.1 using Cmake and Visual Studio 2012 just fine.

Now I decided to try Box2D 2.3.0 so I downloaded the latest svn revision r254 and generated the static build files.
In Visual Studio built Box2D project succesfully, however when attempting to build and run the testbed (I have set the testbed as a start-up project beforehand so that is not the issue) I get 4 linker errors LNK2019.

The errors are:

Quote:
Error 1 error LNK2019: unresolved external symbol "public: void __thiscall b2MotorJointDef::Initialize(class b2Body *,class b2Body *)" (?Initialize@b2MotorJointDef@@QAEXPAVb2Body@@0@Z) referenced in function "public: __thiscall MotorJoint::MotorJoint(void)" (??0MotorJoint@@QAE@XZ) File:TestEntries.obj Project:Testbed

Error 2 error LNK2019: unresolved external symbol "public: void __thiscall b2MotorJoint::SetLinearOffset(struct b2Vec2 const &)" (?SetLinearOffset@b2MotorJoint@@QAEXABUb2Vec2@@@Z) referenced in function "public: virtual void __thiscall MotorJoint::Step(struct Settings *)" (?Step@MotorJoint@@UAEXPAUSettings@@@Z) File:TestEntries.obj Project:Testbed

Error 3 error LNK2019: unresolved external symbol "public: void __thiscall b2MotorJoint::SetAngularOffset(float)" (?SetAngularOffset@b2MotorJoint@@QAEXM@Z) referenced in function "public: virtual void __thiscall MotorJoint::Step(struct Settings *)" (?Step@MotorJoint@@UAEXPAUSettings@@@Z) File:TestEntries.obj Project:Testbed

Error 4 error LNK2019: unresolved external symbol "protected: __thiscall b2MotorJoint::b2MotorJoint(struct b2MotorJointDef const *)" (??0b2MotorJoint@@IAE@PBUb2MotorJointDef@@@Z) referenced in function "protected: static class b2Joint * __cdecl b2Joint::Create(struct b2JointDef const *,class b2BlockAllocator *)" (?Create@b2Joint@@KAPAV1@PBUb2JointDef@@PAVb2BlockAllocator@@@Z) File:Box2D.lib(b2Joint.obj) Project:Testbed

Error 5 error LNK1120: 4 unresolved externals Testbed.exe Project:Testbed


When attempting to build and run the HelloWorld project (again I've set it as the start-up project beforehand) I get these linker errors:

Quote:
Error 1 error LNK2019: unresolved external symbol "protected: __thiscall b2MotorJoint::b2MotorJoint(struct b2MotorJointDef const *)" (??0b2MotorJoint@@IAE@PBUb2MotorJointDef@@@Z) referenced in function "protected: static class b2Joint * __cdecl b2Joint::Create(struct b2JointDef const *,class b2BlockAllocator *)" (?Create@b2Joint@@KAPAV1@PBUb2JointDef@@PAVb2BlockAllocator@@@Z) File:Box2D.lib(b2Joint.obj) Project:HelloWorld

Error 2 error LNK1120: 1 unresolved externals File:HelloWorld.exe Project:HelloWorld


And this same error comes up when trying to build the shared libraries as well.

So is there some thing wrong with the b2MotorJoint class? How can I fix this?
There are a couple of lines missing from the CMakeLists.txt file for the Box2D library. You can to add one line to the CMakeLists.txt file:
Code:
set(BOX2D_Joints_SRCS
   ...
   Dynamics/Joints/b2WheelJoint.cpp
   Dynamics/Joints/b2MotorJoint.cpp # add this line
)
irresistible force wrote:
There are a couple of lines missing from the CMakeLists.txt file for the Box2D library. You can to add one line to the CMakeLists.txt file:
Code:
set(BOX2D_Joints_SRCS
   ...
   Dynamics/Joints/b2WheelJoint.cpp
   Dynamics/Joints/b2MotorJoint.cpp # add this line
)


That worked. Thanks!

Funny thing is... I added that line before I made the opening post, but I forgot to run cmake again so nothing happened. I'm an idiot sometimes 😀

Original thread: https://box2d.org/forum/viewtopic.php?t=9389