Hair-ripping linker/deployment problems

Hello!

Box2D is a fantastic library, thank you Erin for designing it! I've managed to play around with it a little, and it works like a charm. On my own computer. On others' machines, errors along the lines of:

"This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."

After hours of disappointing "solutions", it seems like the real answer is that I have to build my project using /MT instead of /MD. What confuses me though, is that I've read on this forum that Box2D won't work in /MD. Which is odd, because it does over here. I am using Visual C++ 2008 Express edition, if that wasn't apparent.

Anyhow, when I switch to /MT, I get various linker errors, and when I've removed them, I get this final and only message:

"box2d_d.lib(b2PairManager.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z)"

Which I can't understand. So basically, that's my problem. How do I get rid of that linker error? Is it simple? Possible?

Help please -- shed some light onto this situation; I've been trying to kill this problem for hours now. I'm about to give up hope 🙁
Release Build:
/MT means the C release mode runtime library is statically linked
/MD means the C release mode runtime library is dynamically linked via DLL

Debug Build:
/MTd means the C debug mode runtime library is statically linked
/MDd means the C debug mode runtime library is dynamically linked via DLL

The Box2D code supports either setting. However, the Box2D project file has been setup for static linkage. AFAIK, you can't mix runtime libraries, so all your projects must use the same setting. Consistency is the key.

Another caveat: if you build with /MD, then your executable will look for some DLLs. Most likely your users won't have these DLLs, so you have to provide them with your distribution. I use /MT for all the projects in Box2D.sln so that I can distribute an executable file that doesn't require DLLs. The disadvantage is that the executable is larger and may take more memory.

Quote:
Anyhow, when I switch to /MT, I get various linker errors, and when I've removed them, I get this final and only message:

"box2d_d.lib(b2PairManager.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z)"


Hmm, box2d_d.lib is a debug build, so you need to use a debug runtime library (/MTd).
Unbelievable! I've spent more than five-six hours struggling with this -- and it now works!

I just included the Box2D project instead of linking to the .lib file. Thanks for the help 🙂

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