How to fix the MSVCR120.dll missing error

  If you are a Visual Studio user and a C++ programmer then you must have come across MSVCR120.dll missing (or MSVCR120d.dll or MSVCR110.dll or MSVCR100d.dll etc. missing) problem with Win32 and CLR programs created using Visual Studio.

This article is basically meant for programmers. If you’re not a programmer, and you just want to download MSVCR120.dll, you can download it here

How to fix the MSVCR120.dll missing error

These problems occur when you try to execute Visual C++ programs created in any version of Visual Studio (i.e. 2008, 2010, 2012, 2013 etc.) on another computer which does not have the appropriate version of Visual Studio or Microsoft Visual C++ Redistributable installed.

For example, I created a Win32 application using Visual Studio 2013 and tried to execute it on another computer (which does not have Visual Studio or Visual C++ Redistributable 2012 installed). I got the following error message :

"MSVCR120D.dll missing" error

Analysis of the Problem

  Here, the name MSVCR120D tells the following information about the DLL :

MS – Microsoft
V - Visual
C - C++
R - Redistributable
D - Debug
120 – Version 2012 (Visual Studio 2013 uses MS VC++ Redistributable 2012)

Therefore, the above DLL is required for all Visual C++ programs  which are based on Microsoft Visual C++ Redistributable 2012 and compiled in Debug Mode

Similarly, the Visual C++ programs created in Release Mode (based on Microsoft Visual C++ Redistributable 2012) will require MSVCR120.dll.

Again, if I try to run the same application created using Visual Studio 2010, I get the error saying “MSVCR100D.dll” was missing.
 

The Solution

  There are the three ways to solve this problem :

a) Include the DLL in the same directory as the EXE :

  The first method to solve this problem is to include the DLL in the same directory as the EXE. It is quite simple to perform this because all you have to do is to include the required DLL with every program that needs it. However, it is quite problematic in the long run. 

b) Force every user of the program to install the appropriate version of Microsoft Visual C++ Redistributable :

  This method eliminates the requirement of the DLL i.e. you don’t have to provide the DLL with every program that needs it. However, it is very impractical. You can’t expect everyone (i.e. including non-programmers) to install multiple versions of MSVC++ Redistributable.

c) Statically link the DLLs into your program :

  This method is the best way to solve this issue. In this method, the DLL files are compiled into the executable and therefore, there is no need to provide those DLLs separately along with the application. The only problem is that this method does not work in case of CLR based projects. Therefore, you can use this method only with Win32 projects.


The following steps are involved in this method : 

1. Open your project in Visual Studio.

Open your project in Visual Studio


2. Right-click on the project name in Solution Explorer and Click Properties. The Property Pages window of your project will appear.
 

Open the Property Pages of your project


3. Click on Configuration PropertiesC/C++Code Generation.

Click on Configuration Properties, then C/C++ and then Code Generation
4. In the Runtime Library setting, select Multi-threaded Debug (/MTd) if your project configuration is Debug or Multi-threaded (/MT) if it is Release.
Select "Multi-threaded Debug (/MTd) if your project configuration is "Debug"
Select "Multi-threaded (/MT)" if your project configuration is "Release"
5. Click OK. Now, build the solution of your project by pressing F7. The new, standalone executable is ready. It does not need any DLL now. Therefore, now you can execute this program on any Windows Computer without worrying about “MSVCR***.dll missing” errors.
Build the solution by pressing F7

Note :-  The size of the executable in this case will be much larger than the executables which require DLLs, because in this case, the code contained inside the DLL is added to the executable and it works like a static library.

The following video describes how to perform the steps mentioned above :

 
Did this article help you? Let us know in your comments below.
(Visited 1,050 times, 3 visits today)

2 comments

  • That’s quite cool. I spent several days wondering what was wrong with my programs and now I find it’s just a small tweak required to make it all work. Thanks for helping. I was about to go crazy when you saved me. LOL

    • Well, that’s something that bothers most Visual C++ programmers, at least when they start using Visual Studio initially. That’s why we thought it would be a great help to those who are suffering due to this annoying error.

Leave a Reply

Your email address will not be published. Required fields are marked *