Visual studio 2015 debugging with older dlls - c++

I'm trying to debug the sample application from OpenCV under Windows 10 - Visual Studio 2015.
I have already configured Visual Studio according to the OpenCV wiki and I can compile the application and run it fine.
The issue I'm having is when I try to debug the application. I'm getting that the program can't be started because MSVCP120D.dll is missing. I have already installed the Visual C++ 2013 redistributables from Microsoft, however they don't come with the debugging dlls.
The issue probably stems from the fact that the OpenCV version I'm using (D:\opencv\opencv\build\x64\vc12) was compiled with 2013. Is there a way to get the debugger version of this dll? Or start the debugger without it? Or am I stuck having to recompile OpenCV with 2015?
Thanks.

Or am I stuck having to recompile OpenCV with 2015?
You probably are since it is a really bad idea to mix different runtime dlls. In your case you're mixing your compiled program (MSVC 2015) with the OpenCV dlls (MSVC 2013).
You should do either of these:
Compile your program with MVSC 2013, which I believe will require you to install MSVC 2013 on your machine
Compile OpenCV using MSVC 2015.
Note: This is probably gonna be better with programs compiled with MSVC 2015 and later compilers because of the Universal CRT

Related

mfc100d.dll is either not designed

I compiled my program (blobtracking) and this error appeared.
C:\Windows\system32\mfc100d.dll is either not designed to run on Windows or it contains an error.
Anyone know what should I do?
I did install Microsoft Visual C++ Redistributable dll (2005 and 2008 version). But it didn't work.
p.s: I use VS 2010 32-bit and OpenCV 3.0

MSVCP100D.dll is missing (OpenCV) Visual Studio 2013

So, in Visual Studio 2013 I created a program in which I use OpenCV.
But when I want to compile the program, there is an error that the MSVCP100D.dll is missing. I compile it in Debug version and I don't want to compile the program in Release version, so I need this file.
I tried to install the Microsoft Visual C++ 2010 Redistributable Package, but it is already on my computer.
Should I download the single file (MSVCP100D.dll) and paste it in C:\windows\system32\? Because there I can find the MSVCP100.dll file, but not the MSVCP100D.dll file.
I also read related questions about this problem, but it didn't help.
Edit: And now the MSVCP110D.dll is missing too. Same error, but now the MSVCP110D.dll file.
You have some code compiled in Visual Studio 2010. Recompile the code in Visual Studio 2013 to get rid of the MSVCP100D.dll dependency (replace it with MSVCP120D.dll that is).
Solution (Worked for me): In your Visual Studio project properties, under Linker>General>Additional Library Directories, use $(OPENCV_DIR)\x64\vc12\lib (For your system this may change depending on whether you use x86 or x64 version). Then your program should run. At least it worked for me :)
Explanation: I had the same problem with same version of OpenCV and VS. After a lot of research I found out that the problem might be incompatibility of OpenCV's pre-built binaries with Visual Studio 2013.
#Sheng Jiang's answer helped me. I used dependency walker and found that opencv_core2410d.dll depended on MSVCP100D.dll because opencv libraries that I was using were complied using Visual Studio 2010 (placed in vc10 folder) and MSVCP100D.dll is associated with Visual Studio 2010.
One option was to recompile the OpenCV code with Visual Studio 2013 (as suggested by Sheng Jiang's answer above). But this was unnecessary since OpenCV 2.4.10 already provides pre-built libraries built using Visual Studio 2013. These pre-built libraries are in the C:\opencv\build\x64\vc12 folder (exact path might differ for your machine).
Here comes the importance of vc10, vc11 and vc12 libraries. You choose the folder corresponding to the version of Visual Studio you are using. My mistake was to choose vc10 instead of vc12.

How to correctly install platform toolsets

I know there are tons of other threads about it, but I couldn't find any which could help me.
So I've got VS2013 Ultimate installed. I've got an old project which works with only VS2008SP1. On other compilers it has compatibility issues which I don't want to bother with. So I would like to try to compile it from 2013 with 2008 tools, so I hope I can compile it without uninstalling my current VS2013.
So, if I install VS2008, will this overwrite my current 2013 or just getting added as a toolset?
If I use 2008 toolset, will this work the same way as I had a VS2008?
Do I have to do something else to make it work?
And just a secondary question which is not related to may current question at all:
If I compile a lib with VS2013, can I use this lib in my VS2008 Project, or do I have to compile the lib with VS2008 too?
Thank you for your answers!
Microsoft doesn't recommend installing VS 2008 if you already have VS 2013 installed. In general they say:
We recommend that you install Visual Studio versions in the order in
which they were released. For example, install Visual Studio 2012
before you install Visual Studio 2013.
http://msdn.microsoft.com/en-us/library/ms246609.aspx
So, to answer your question: you probably should uninstall VS 2013, but you can install it again after installing VS 2008. Before doing that though it might be a good idea to clean the register as well as file leftovers from VS 2013 to avoid compatibility problems.
And yes, you can use 2008 compiler in 2013 version. There are a plenty of SO thread about it, e.g. :
Use Visual Studio 2012 and compile with older platform toolset?
How can I use Visual Studio 2010 with the Visual C++ 2008 compiler?
If I compile a lib with VS2013, can I use this lib in my VS2008
Project, or do I have to compile the lib with VS2008 too?
You have to compile this lib in VS 2008, if you want to use it with VS 2008.

Compile in Visual Studio 2013 for Visual Studio 2010 Redistributables

I have installed MS VS Express 2013 on my office computer, and compiled a DLL with it. Now when my colleague is trying to use it, she gets an error about a missing MSVCR120.DLL. We have found MSVCR100.DLL on her PC. I know that we can get MSVCR120.DLL from Microsoft. However
it will probably require admin rights, and only I have them in our team. I wonder if I can ask VS 2013 to compile the DLL so that it uses older version of redistributables? Or is installing the previous version of VS the only solution?
I found the solution — here: https://stackoverflow.com/a/1073772/674976. The distributable DLL can be statically linked to my DLL, thus removing the dependence. This is done in VS 2013 in Project Properties (Alt + F7) > Configuration Properties > C/C++ > Code Generation > Runtime Library, which should be set to Multi-threaded (/MT) from the default Multi-threaded DLL (/MD).
However, I wonder if by doing so I am actually still using redistributable DLLs of two versions and thus risk mixing the heaps and potentially causing memory allocation problems.
If someone suggests a better solution or a clear explanation why I should simply use Visual Studio 2010, I'll be happy to accept it is an answer.
Visual Studio 2013 can build Visual Studio 2010 C++ projects. To do this, you need to also have Visual Studio 2010 installed, because VS2013 will actually call the VS2010 C++ compiler.
What I have done to accomplish this is to create the solution and all the projects in Visual Studio 2010 and make sure that they build and run correctly. Then open them in Visual Studio 2013 and make sure to NOT upgrade the projects to VS2013.
Now you can use the latest tool and still build the VS2010 dlls that you need.

Visual Studio 2012

I am Having some issues with Visual Studio 2012, When build my solution and run the debug it says MSVCP100D.dll is missing
Screen dump:
When i try to run my program using Release it compiles fine and runs but then it randomly runs into run time error:
it then will not build any more underlining these CV_8U & CV_8UC3
I am using OpenCV library, also my code worked perfectly fine on Visual Studio 2010; but i decided to upgrade to 2012.
I would ideally Build my solution using DEBUG..........
Any solutions or suggestions...?
Regards
It looks like you are linking against the opencv libs for Visual Studio 2010. You will have to compile the opencv library for Visual Studio 2012 yourself as the pre-built ones are for Visual Studio 2010.
The information on how to do that can be found under Installation by Making Your Own Libraries from the Source Files.