How to fix error MSVCP120D.dll in Visual Studio 2015? - c++

Hello I have downloaded and unzipped OpenCV-2.4.10.exe on my PC. Then created a new Win32 Console application project in VS 2015, set all the Paths in Project properties, set the environmental variables in Win8.1. When I'm trying to start the program in debugging mode I get the "The program can't start because MSVCP120D.dll is missing from your computer. Try reinstalling the program to fix this problem".
Then, I downloaded the Visual C++ redistributable for Visual Studio 2015 But the problem still remains. What should I do to use OpenCV in VS 2015?

OpenCV-2.4.10.exe comes with runtime binary dlls built to work with runtimes from vc10 (vs2010), vc11 (vs2012) and vc12 (vs2013).
These DLL files use MSVCP100.dll, MSVCP110.dll and MSVCP120.dll respectively, and if you have installed Visual Studio 2015 you should find them in your System32 (or SysWOW64) directory.
The MSVCP120D.dll error appears when your application tries to load the DEBUG version of the DLL binaries. You do not have MSVCP120D.dll unless you have Visual Studio 2013 installed on your system. To solve this problem, use the Release runtime instead of the Debug runtime.
All you need to do is exclude the DEBUG lib files from your project. This means including only the lib files without the suffix 'd'. (ie. include opencv_core2410.lib instead of opencv_core2410d.lib)
HTH
Extras:
You don't really need to load the Debug binaries, unless you need to debug openCV's source code. If you do, there's still a way. Download the openCV source code, use CMake to create a VS2015 project. You can then build your own dll binaries using the latest runtime from VS2015.

VS2015 uses vc14 while OpenCV2.4.10 doesn't come with pre-built binaries associated with vc14. This answer should help you to understand. Accordingly you should choose the right folder (vc14) for Linker>General>Additional Library Directories in project properties.
You can use cmake to build binaries using VS2015 or you can download a later version of OpenCV which has prebuilt binaries for vc14.

Related

Trouble generating a deployable binary for a C++ wxwidgets project using Visual Studio

I’m having trouble generating a deployable binary for a C++ wxwidgets project using Visual Studio. After the build completes, the exe that is generated does not seem to get installed in any other Windows machine.
Visual studio 2019 is used to create GUI library with openCV included in it. I’m trying to create a standalone executable .exe to run it in any other Windows computer without installing visual studio or opencv in it.
Earlier, while opening the executable file in other computer, it gave error that dll’s are missing for openCV and wxwidgets. So, I have copied the required dll’s from the directories of openCV and wxwidgets bin folder. Now, when I try to execute the exe file, it shows the following error. Kindly help me to resolve this issue.
Applications built with the C/C++ runtimes dynamically linked (/MD[d]) require the appropriate x86 (32-bit) or x64 (64-bit) VC++ redistributables on the target machine. They can be installed from The latest supported Visual C++ downloads, or they can be included alongside the application for local deployment.
Also, be sure to only send out non-debug (Configuration = Release) builds.
MSVCP140D.dll
VCRUNTIME140D.dll
VCRUNTIME140_1D.dll
ucrtbased.dll
The 'D' suffix in the names of those missing DLLs stands for "Debug". Those are the debug C/C++ runtime DLLs, which are used by the Configuration = Debug builds, and are installed as part of the Visual Studio setup. They are to be used during development, but not otherwise deployed, per Determining Which DLLs to Redistribute:
Debug versions of applications and the various Visual C++ debug DLLs are not redistributable.
It also seems that you are using DLL build of wxWidgets and you build OpenCV as DLL.
If you yourself does not create a DLL and your software is one self contained binary ou will be better off using static linking wxWidgets and OpenCV.
And on top of what #dxiv, not everything in MS CRT can be used statically linked. That's why it is strongly recommended to install MS CRT by creating an installer, which should take care of all those dependencies.
HTH.
Thank you.

Link to a specific .dll file in Visual Studio?

I have written a C++ program using OpenGl in Visual Studio 2015 for Windows 7. I compiled my code using "release" instead of "debug". The program works fine on my computer, but when I move to another computer the program fails. I get the error message:
The program can't start because MSVCP140D.dll is missing from your computer. Try reinstalling the program to fix this problem.
I would like for my program to work on other computers so that I don't have to install the newest drivers or libraries in order for it to work. I have MSVCP140D.dll on my first computer, but I only have MSVCP120.dll on my other computer. How do I compile my code so that it does not require MSVCP140D.dll, but instead works with MSVCP120.dll?
First make sure your build settings are correct for release build : MSVCP140D.dll is the debug DLL of the Visual Studio 2015 runtime; the release version of this libray is MSVCP140.dll.
When you've fixed this, then you can install the Visual C++ Redistributable for Visual Studio 2015 on the target computer where you want to run your program : this will install the missing library. Notice that the VC++ redistributable does not install the debug libraries (MSVCP140D.dll) but the release ones (MSVCP140.dll).
Another option is to rebuild your program with static linking to the Visual C++ runtime. Open the Project Properties dialog and, in "Configuration Properties -> C/C++ -> Code Generation", field "Runtime Library", choose "Multi-threaded (/MT)". This way, there is no need to install the VC++ redistributable on the target computer.
You need to install Visual Studio 2013 in order to be able to link with MSVCP120.dll (you can continue using MSVC 2015, but select 2013 as the toolchain). Once MSVC 2013 is installed, you will be able to select it in project settings -> Platform Toolset.
Or link your application statically (change /MD to /MT in Code Generation settings). Then your app won't need any MSVC DLL to run (but it will become bigger).
Or install the VC 2015 Redistributable package on your other computer.

MSCVP120D.dll missing even though redistributable is installed?

I'm creating a C++ application using Visual Studio 2013 and using libraries such as FMOD and SDL. I'm trying to package the application to run on other machines through the .exe. I have all my library paths correct and dependencies referenced locally, but when I run the .exe on another machine I get the "MSCVP120D.dll not found" error.
I have installed the Visual Studio 2013 redistributable on these test machines (Since it's 120.dll) and yet the error persists.
As far as I'm aware, other than the libraries specified, which all work, I'm only using standard libraries and windows.h.
I have been told another option is to install the dll file locally and link it statically to the CRT, but honestly I don't know enough to know if this is a correct option or not.
For more information, I'm on a Windows 8.1 machine and have tested on Windows 8 and 7, with no success other than on my own machine.
You are compiling your program in debug-mode and linking to the MS C++ debug-runtime.
Change to release-configuration, and either compile it statically or preferably add the Visual C++ Redistributable Packages for Visual Studio to your deployment (the last part is not neccessary if it's already installed).

Can't Compile Solution in Debug Mode Because MSVCR100D.dll is Missing

I am running Microsoft Visual Studio Express 2012 for Windows Desktop on a 64 bit machine with windows 8.
I create a completely new Win32 Console Application (in C++) and accept the default options. I then build and run the solution in both debug and release modes and it works all find and dandy. Next I configure the include and library directories for the dynamic SFML library. I link to the debug and release .lib files and put the debug and release .dll files in the proper directories. I then add some simple code which uses the library, build and run the application in debug mode and I get this error: "The program can't start because MSVCR100D.dll is missing from your computer. Try reinstalling the program to fix this problem." If I build and run the application in release mode it works with no errors. (And yes I have the redistributables installed 32 and 64 bit.) Now from what I understand and according to this thread that .dll file is for debugging only and is not included in the redistributable package (which would explain why it doesn't work in debug mode). The answer says that developers have it installed with visual studio by default. This is obviously not the case as evidence from the error and I've reinstalled visual studio and restarted my computer twice now.
In conclusion, how do I simply compile my solution in debug mode without getting this error?
I'm afraid someone will mark this as a duplicate so here we go:
LINK - "...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."
Doesn't pertain to me because I'm not distributing this app, just trying to run it in debug mode.
LINK - "I compiled my program using Microsoft visual c++ 2010 Express Edition and tried to run it on another machine that did not have the same compiler."
This person get's the error when he runs what hes compiled on a different computer, not when actually compiling the application.
LINK - "If you get this error for your release build..."
I dont.
LINK - "You can compile your project in "Release"..."
My project is not ready to be released therefore I should compile my project in debug mode.
MSVCR100D.dll is the dll for Visual Studio 10, so somewhere something is depending on it (the SFML dlls?). Whatever you compile (in debug mode) with Visual Studio 2012 will require MSVCR110D.dll, which you should have available on your machine as part of the installation.
I suggest you build SFML yourself on your own version of Visual Studio, it's pretty easy. In fact, the binaries available on the site as part of the SFML 2.0 RC are rather old and you'll do yourself a huge favor by building from the latest sources, as a lot of fixes and improvement were applied in the meantime.
(Also, definitely use 2.0 instead of 1.6. The site is rather misleading, but on the SFML forums virtually everyone will recommend you use the last version)
This message generally states that the dll is referred to directly or indirectly in your application and is missing.
The 'D' at the end show us this is the Debug version of the file, this is DLL file is provided with the Visual Studio 2010 installation. So the MSVCR100D.dll would be provided with the installation of Visual Studio 2010.
Of course, you could be missing other versions 2008 (MSVCR90D) 2010 (MSVCR100D) 2012 (MSVCR110D) or the 2013 (MSVCR120D), each dll is provided according to the Visual Studio version.
There are a few ways to solve this:
Check to be sure that you're compiling all the components of your
project in Release mode. If this does not solve the issue continue
to the next steps.
You could solve this locally by installing Visual Studio 2010 on your
machine. This is not what I would recommend, but it would surely
overcome the issue
You could also download the file from this third party website and
copy it to your projects bin:
http://www.dll-files.com/dllindex/dll-files.shtml?msvcr100d
This option is the LEAST recommended option.
Run dependency Walker and see what file depends on the MSVCR100D.dll
and the try and fix that file in order to break your dependency. You can download depends here: http://www.dependencywalker.com/
Check to be sure that you're project is linking the correct version of
the CRT and any other libraries you may be using (e.g., MFC, ATL,
etc.)
Note: Installing the redistributables alone will NOT solve this problem, since the redistributables only contain the release version of the file MSVCR100.dll (notice no 'D')
MSVCR100D is part of the 2010 Visual Studio package - indicating that some components of your system are compiled with the older version of Visual Studio, so you will need to install the Visual Studio 2010 version - you can probably still develop with the 2012 version, just as long as [parts of] the 2010 is on the machine.
Or you need to recompile some components that your application depends on to use the 2012 (msvcr110d) libraries - if you have all the source code, that would be my preferrred method.

Building an OpenCV application with Visual Studio 2008 and running it from another computer

I've made a simple OpenCV application with Visual Studio 2008 and I've built it in both release mode and debug mode.It works fine from my computer but when I try to run it from another computer which doesn't have OpenCV installed or has another version of Visual Studio with OpenCV it doesn't work.
How can I make the app work from a computer which doesn't have either Visual Studio or OpenCV installed ?
I'm thinking to add the external dependencies ( lib's and dll's ) into the app's folder, change the path in Visual Studio and rebuild it.
Thanks in advance and sorry for the ultranoobish question :)
You don't need to distribute the libs; those are just needed for building the executable.
Just copy the dlls somewhere where the executable can see them (either in the same dir as the exe, or in a dir that's on the system path) and you should be golden.
Copying DLL's with the application or to the path is a good start, but may not be enough. It took me a long time to find out why OpenCV application didn't work on another machine. Visual Studio runtime and OpenMP are used by OpenCV. Those are not installed by default and error messages, if any, are not all that helpful.
You need to build OpenCV and your application with setting (in Visual Studio):
Configuration Properties -> C/C++ -> Code Generation -> Runtime Library -> Multi-threaded (/MT)
You need to disable OpenMP support too if that's the problem. Build system changed with OpenCV 2.0. If I remember right, older version had different project files for version without OpenMP.