Application has failed to start because MSVCP100D.

2019-01-09 17:14发布

问题:

I googled on this and realized there are probably several causes to this so I will describe my scenario.

This happens when my application tries to load a .dll file built in another version of Visual Studio (2010), if I build the same project on Visual Studio 2008 the DLL file loads just fine...

I don't know if it matters, but Visual Studio 2010 DLL file version is built on Windows 7 x32, and Windows Vista 64-bit is on the other side with Visual Studio 2008.

回答1:

If you link dynamically to the MSVC runtime then you need to install that runtime on every machine that will run your app.

Note that in this case you appear to be linking to the debug version of the runtime, it is not normal to distribute apps linked against the debug version of the runtime.



回答2:

If you do not want to distribute the runtime, then you can switch your Runtime Library options in Visual Studio (Properties -> C/C++ -> Code Generation -> Runtime Library) from /MD to /MT or from /MDd to /MTd.

As others have said, if you are distributing this application you should be linking dynamically or statically to the Release version of the Runtime library, not the Debug version.



回答3:

Just an small related advice: DON'T ADD any *248d.lib files while building and running in the RELEASE version.

I was following advice from different blogs, and I accidentally added both *248d.lib as well as the 248.lib files. Basically in LinkerInputAdd Dependencies, ensure that you don't have *248d.lib files in it (here 248 is version 2.4.8).

I spent hours wondering why things weren't working in the release mode until it struck me that there are two copies of .lib files, one *248 and other *248d. If you include any of the d files in release mode, you will get the DLL issue.