Unresolved external call, missing definitions?

When I try to run a program with Box2D included, it compiles just fine, but when it gets to linking, I get this:

1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall b2World::~b2World(void)" (??1b2World@@QAE@XZ) referenced in function "class b2World * __cdecl xyMakeWorld(float,float)" (?xyMakeWorld@@YAPAVb2World@@MM@Z)
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall b2World::b2World(struct b2Vec2 const &)" (??0b2World@@QAE@ABUb2Vec2@@@Z) referenced in function "class b2World * __cdecl xyMakeWorld(float,float)" (?xyMakeWorld@@YAPAVb2World@@MM@Z)
1>C:\Users\Midi\Documents\Visual Studio 2008\Projects\XYG\Debug\XYG Template.exe : fatal error LNK1120: 2 unresolved externals

When I look at the b2World class, I see definitions for all its functions in the source except the constructor and deconstructor. Where are these functions? Is there a missing .lib file I'm supposed to link to? When I downloaded Box2D release, all that was there was source, so I figured it must just be raw code without a .lib file (cuz I thought that would make it purely cross-platform, not having to depend on a different library format for each OS).

Does anyone know what I'm doing wrong here?
I think you are supposed to build the .lib from the source. There should be some project files to use included with the source.
irresistible force wrote:
I think you are supposed to build the .lib from the source. There should be some project files to use included with the source.


*sigh* I don't see why an entirely math-composed library should need building. It's open source and cross platform, so why can't it be made to just include the main header, and the rest is already linked? I'm sorry for complaining, but I tried both the compile methods in the readme, and neither of them worked. The project file for Visual Studio is for a newer version, and I hear installing two versions of Visual Studio on the same computer is dangerous, but I can't switch to VS10 because some of the basic features require internet for some reason, and the only internet connection I have is my phone, so I have to keep VS9 installed.

I tried Box2D Lite, but that has no documentation at all, and I can't find any tutorials online anywhere.

Again, I'm sorry for the grief, but I don't know what to do, and this is really, really frustrating me.
Like you say, it's open source. Should the author also buy every available compiler, and all devices that people might want to use the library on, and build and check on all of them, and keep these updated for every release? Not likely.

If it makes you feel better, I have built and run Box2D successfully on about 5 platforms, with about 6 different compilers, in 3 languages, and yet I gave up on Visual Studio after spending over 4 hours trying to get the lib to link 🙄

You can always just add all the .cpp files for Box2D to your project directly, then you don't need to make a lib in the first place.

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