43

Every time I want to compile my Visual Studio project I get the message that MSVCP120d.dll is missing. Google can't help me. I already installed some redistributables but they didn't help. I also found this:

Msvcp120d.dll Debug version of C++ runtime. No redistribution allowed.

http://msdn.microsoft.com/en-us/library/windows/hardware/dn448963(v=vs.85).aspx

drescherjm
  • 10,365
  • 5
  • 44
  • 64
MazzMan
  • 815
  • 1
  • 9
  • 15
  • You probably need to install the Visual Studio runtimes. Check if you need 32 bit or 64 bit (or install both). – Thom Wiggers Feb 11 '14 at 16:54
  • Like I said I already installed the redistributables. When I google for vs 12 runtimes I only find the redistributables. – MazzMan Feb 11 '14 at 16:58
  • Did you install both x86 and x64? You need the one that matches what your compile target is I think. It also is a debug version: maybe the debug runtime? You could also try repairing your Visual Studio installation by the way. – Thom Wiggers Feb 11 '14 at 17:01
  • 5
    Only deploy the Release build of your program, never the Debug build. – Hans Passant Feb 11 '14 at 17:06
  • 3
    MSVCP120 is for VS2013. VS2012 should be looking for MSVCP110. Is this a 2012 or 2013 system? – cup Feb 11 '14 at 17:07
  • @cup I'm using VS2012 – MazzMan Feb 11 '14 at 17:36
  • So there is your problem. Make sure all the dlls you use in your application were built with Visual Studio 2012. – drescherjm Feb 11 '14 at 18:08
  • 1
    @drescherjm I'm using the opencv dlls from the vc12 folder, so I guess they are build with VS2012 – MazzMan Feb 11 '14 at 18:29
  • 3
    I would use depends on the files to verify. Also vc12 could mean Visual Studio 2013. The 2 digit compiler version does not match the year. Well it did for 2010 but in general it does not.. This is also why the number in the msvcpXXX does not match the year. – drescherjm Feb 11 '14 at 18:36
  • 2
    @drescherjm Oh, thanks! I changed the vc12 to vc11. now everything works perfectly :) – MazzMan Feb 11 '14 at 18:46
  • since it says 120d, it must be "Visual C++ Redistributable for Visual Studio 2012 Update 4" from https://www.microsoft.com/en-us/download/details.aspx?id=30679 – George Birbilis Sep 01 '16 at 10:26
  • I had the same problem. When I run my test program to another machine, it poped-up a message telling MSVC***.DLL is missing. After some time I discovered that my app is built on Debug mode. I build again in Release mode and then my app run successfully. – acegs Nov 10 '17 at 08:27
  • @HansPassant Why not use debug build? – Sndn Dec 14 '17 at 03:14

8 Answers8

62

From the comments, the problem was caused by using dlls that were built with Visual Studio 2013 in a project compiled with Visual Studio 2012. The reason for this was a third party library named the folders containing the dlls vc11, vc12. One has to be careful with any system that uses the compiler version (less than 4 digits) since this does not match the version of Visual Studio (except for Visual Studio 2010).

  • vc8 = Visual Studio 2005
  • vc9 = Visual Studio 2008
  • vc10 = Visual Studio 2010
  • vc11 = Visual Studio 2012
  • vc12 = Visual Studio 2013
  • vc14 = Visual Studio 2015
  • vc15 = Visual Studio 2017
  • vc16 = Visual Studio 2019

The Microsoft C++ runtime dlls use a 2 or 3 digit code also based on the compiler version not the version of Visual Studio.

  • MSVCP80.DLL is from Visual Studio 2005
  • MSVCP90.DLL is from Visual Studio 2008
  • MSVCP100.DLL is from Visual Studio 2010
  • MSVCP110.DLL is from Visual Studio 2012
  • MSVCP120.DLL is from Visual Studio 2013
  • MSVCP140.DLL is from Visual Studio 2015, 2017 and 2019

There is binary compatibility between Visual Studio 2015, 2017 and 2019.

drescherjm
  • 10,365
  • 5
  • 44
  • 64
  • all the VC++ redistributables in one place: https://support.microsoft.com/en-us/kb/2977003 - warning: they use same filenames with no version identifier on them (just vcredist_x86.exe etc.) – George Birbilis Sep 01 '16 at 10:13
  • 1
    What if we're using VS 2017? – Sndn Dec 14 '17 at 03:09
52

I have found myself wasting time searching for a solution on this, and i suspect doing it again in future. So here's a note to myself and others who might find this useful.

If MSVCP120.DLL is missing, that means you have not installed Visual C++ Redistributable Packages for Visual Studio 2013 (x86 and x64). Install that, restart and you should find this file in c:\Windows\System32 .

Now if MSVCP120D.DLL is missing, this means that the application you are trying to run is built in Debug mode. As OP has mentioned, the debug version of the runtime is NOT distributable.

So what do we do?

Well, there is one option that I know of: Go to your Project's Debug configuration > C/C++ > Code Generation > Runtime Library and select Multi-threaded Debug (/MTd). This will statically link MSVCP120D.dll into your executable.

There is also a quick-fix if you just want to get something up quickly: Copy the MSVCP120D.DLL from sys32 (mine is C:\Windows\System32) folder. You may also need MSVCR120D.DLL.

Addendum to the quick fix: To reduce guesswork, you can use dependency walker. Open your application with dependency walker, and you'll see what dll files are needed.

For example, my recent application was built in Visual Studio 2015 (Windows 10 64-bit machine) and I am targeting it to a 32-bit Windows XP machine. Using dependency walker, my application (see screenshot) needs the following files:

  • opencv_*.dll <-- my own dll files (might also have dependency)
  • msvcp140d.dll <-- SysWOW64\msvcp140d.dll
  • kernel32.dll <-- SysWOW64\kernel32.dll
  • vcruntime140d.dll <-- SysWOW64\vcruntime140d.dll
  • ucrtbased.dll <-- SysWOW64\ucrtbased.dll

Aside from the opencv* files that I have built, I would also need to copy the system files from C:\Windows\SysWow64 (System32 for 32-bit).

You're welcome. :-)

bot1131357
  • 877
  • 8
  • 25
bot3663369
  • 623
  • 5
  • 7
  • 2
    If you aren't **actually** exploiting `Debug` libraries but instead just trying to compile in default VS "Debug" configuration, you can simply change to a "Release" configuration. – Patrizio Bertoni Nov 10 '15 at 10:38
  • 1
    For me the program didn't compile with "Multi-threaded Debug (/MTd)" only with instead "Multi-threaded Debug DLL (/MDd)". The solution in my case (that I have additional dependencies and no MSVCP120D.DLL version,only the MSVCP120.DLL ) was: 1) change to debug mode; 2) change the Linker>Input>> Additional dependencies libraries to their no debug versions (without the "d"). – asam Apr 14 '16 at 14:55
  • 1
    I did a subtle mistake. As mentioned here "Visual C++ Redistributable Packages for Visual Studio 2013 (x86 and x64).". YOU need to INSTALL BOTH 86 and 64 versions. (https://www.microsoft.com/en-us/download/details.aspx?id=40784) I only installed 64 version. But after installing both problem went away for me. – Tyagi Akhilesh May 26 '16 at 09:03
4

I have the same problem with you when I implement OpenCV 2.4.11 on VS 2015. I tried to solve this problem by three methods one by one but they didn't work:

  1. download MSVCP120.DLL online and add it to windows path and OpenCV bin file path
  2. install Visual C++ Redistributable Packages for Visual Studio 2013 both x86 and x86
  3. adjust Debug mode. Go to configuration > C/C++ > Code Generation > Runtime Library and select Multi-threaded Debug (/MTd)

Finally I solved this problem by reinstalling VS2015 with selecting all the options that can be installed, it takes a lot space but it really works.

rookiechen
  • 41
  • 2
  • I'm in the same boat trying to get OpenCV 3.1.0 to work on VS 2015. I tried all three of those solutions to no avail. I am debating trying your fix of installing all. Are you using VS community? – NickF Aug 25 '16 at 15:38
  • Thanks, worked for my basic "hello world" project in C++ (which was using Windows.h and iostream, and didnt want to work on 64 bit system) – liquide May 11 '17 at 16:54
4

I downloaded msvcr120d.dll and msvcp120d.dll for 32-bit version and then, I put them into Debug folder of my project. It worked well. (My computer is 64-bit version)

Pavneet_Singh
  • 36,884
  • 5
  • 53
  • 68
Anandi
  • 41
  • 1
  • This comment helped me, but it didn't provide the place to download the file. I managed to download the community edition of VS2013 (32 bit) and copied the files to debug folder. – Jerin Jun 19 '19 at 16:46
2

My problem was with x64 compilations deployed to a remote testing machine. I found the x64 versions of msvp120d.dll and msvcr120d.dll in

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist\x64\Microsoft.VC120.DebugCRT
empty
  • 5,194
  • 3
  • 32
  • 58
2

I had the same problem in Visual Studio Pro 2017: missing MSVCP120.dll file in Release mode and missing MSVCP120d.dll file in Debug mode. I installed Visual C++ Redistributable Packages for Visual Studio 2013 and Update for Visual C++ 2013 and Visual C++ Redistributable Package as suggested here Microsoft answer this fixed the release mode. For the debug mode what eventually worked was to copy msvcp120d.dll and msvcr120d.dll from a different computer (with Visual studio 2013) into C:\Windows\System32

lahmania
  • 361
  • 2
  • 5
0

Alternate approach : without installation of Redistributable package.

Check out in some github for the relevant dll, some people upload the reference dll for their application dependency.

you can download and use them in your project , I have used and run them successfully.

example : https://github.com/Emotiv/community-sdk/find/master

mail2subhajit
  • 1,106
  • 5
  • 16
0

I was building my application on VS 2019 when this issue came up. You can copy these DLLs from this location into debug directory of your application to get going.

RBT
  • 24,161
  • 21
  • 159
  • 240