Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I determine which c++ redistributables my program needs to run?

Tags:

Is it possible that I need to install both a vcredist for vs2012 AND for vs2010?

I just had an error where my app couldn't load a .dll and it suddenly started working after I did an unrelated installation, which prompted me to guess that it must have installed an older vcredist which fixed the issue. However I'm sure I'm using c++11 features.

like image 688
Blub Avatar asked Sep 03 '13 14:09

Blub


People also ask

How do I know my VC redistributable version?

To check if Visual C++ redistributables are installed, open Add and Remove Programs and look for the Microsoft Visual C++ Redistributable. If installed, you see "Microsoft Visual C++ 2015-2019 Redistributable (x64) - 14.22. 27821".

Do I need all these C++ redistributables?

We don't recommend that you delete any Visual C++ redistributable, because doing so could make multiple applications on your computer stop working. Given how little space they take up and how broadly they are used, it doesn't seem worth the hassle to mess with your current ecosystem of standard library files.


1 Answers

Deployment is a job on its own. And I hate it, I hate the way you have to write installations on Windows. …So that feel better now…

You only need one vcredist. The one the linker decided to link your program to. If you have the "Windows SDK's" installed you will find the actual redist in:

C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\vcredist_x86 

If you install all updates including the not important ones, Microsoft will update your redist in that folder!

Maybe you have an executable, which do not want to run, you need the dependency walker. A tool, so usefully that Microsoft had to remove it from the Visual Studio. Download the program and open your exe in it. You do not need to understand what really happen. As long as no Dialog comes up during opening, everything is okay, even if there are exclamation marks in the bottom window. If a Dialog comes up with something like "Could not resolve" than look in the bottom window. Usually there is now in the lower window something like "msvcr.dll" or "msvcr100.dll" or "msvcr110.dll". If it includes an "d" before the extension like "msvcr100d.dll" the executable was compiled in debug mode and your journey ends on a system without installed compiler. If not, the name is telling you which vcredist you need:

msvcr100 = VS 2010 redist (32bit) (64bit)

msvcr110 = VS 2012 redist (32/64bit?)

sometimes it is not msvcr but it always starts with "ms". Of course the program will tell you every dll which is missing, not only microsofts and which command in the dll is used. This is sometimes extremely useful. You have to do that with every dll in the folder of your executable as they can also have unresolveable dependencies.
Back to your first question. Your program can only link to msvcr100 or msvcr110, not to both, that is the reason you only need one vcredist per executable. As mentioned in a commentary, A third party DLL can be guilty of using a different msvcp version. So yeah, you have to search all DLL's you use and you have to install both vcredist some times.

PS: There are always at least two of them, msvcr and msvcp.

like image 95
Martin Schlott Avatar answered Oct 23 '22 01:10

Martin Schlott