Manifest gotchas

For those of you using Visual Studio 2008, and using it’s C++ TR1 support in SP1, here’s something I wish I hadn’t spent so much time tracking down..

TR1 features only exist in 2008 SP1, but the linker will happily build a manifest to link against the pre-SP1 CRT even if you’re using TR1. Some systems (including your development machines) will have proper side-by-side library redirection from the old CRT to the new one. But machines with the old runtime installed won’t fail to load the DLL, they’ll just mysteriously fail to find symbols in it. For example, one machine failed to find std::tr1::weak_ptr and gave the following error:

The procedure entry point ?_Xweak@tr1@std@@YAXXZ could not be located in the dll MSVCP90.dll

The solution is to force your project’s manifest to specify the lastest CRT version by defining the following macro:

_BIND_TO_CURRENT_CRT_VERSION

Microsoft’s full explanation is here.

©2011-2020 Justin C. Miller.   What a horrible night to have a curse.