Using VS2015 Express, deleted VS2013 Community, can't run "MSVCP120d.dll missing" - c++

As per the title. I had VS2013 Community installed, I had started a project on that and then moved on the VS2015 Express and converted the project. Recently I needed extra space on my machine so I deleted 2013C using Add or Remove Programs, but now my code gives an exception immediately on running, saying "The program can't start because the MSVCP120D.dll is missing from your computer. Try reinstalling the program to fix this problem." I went and installed the VS2013 redist, and the problem still persists. Is it possible to solve this without reinstalling the entirety of VS2013?
The odd thing is, the DLL it's looking for is a debug DLL, and I'm running the .code in release mode, and I did check, the runtime library is /MT not /MTd
The .dll doesn't exist in my /Windows/System32 folder despite me having installed the redist.
Edit: I found a copy of the dll and installed it but not the code just doesn't run, it doesn't give the same exception but it just says failed to start.

The d library is not "redistributable" and only exists in the development environment.
My recommendation is to use the depends tool (drag executable into depends.exe and it shows the dll dependency), which is part of the windows kits SDK to open your executable.
That should highlight a DLL which was built with the earlier 120d configuration, and can be re-built.
I think the VS 2013 is a side-by-side assembly, and has very strange locations (windows\system32\winsxs).

Related

C++ program not running on windows systems without VS installed "VCRUNTIME140.dll was not found"

When I compile a simple program:
#include <iostream>
using namespace std;
void main() {
cout << "Hello world!";
}
And tun the compiled .exe on another system without visual studio installed I receive the following error:
The Code execution cannot proceed because VCRUNTIME140.dll was not found. Reinstalling the program may fix the problem.
When I compile with cl.exe I receive no errors,
does anyone know a workaround to this without installing VCRUNTIME140.dll on the systems. (I've tested on multiple windows systems including a windows virtual machine)
I've encountered this problem before and there's a simple solution to it,
The missing .dll are a issue of static linking not missing packages (in most cases),
becuase visual studio 2019 comes pre-installed with what you need.
To fix:
go to your project properties (in project tab)
Select C/C++
Change the value of runtime library to "Multi-threaded debug (/MTd)"
This will cause the compiler to embed the runtime into the app.
The executable will be significantly bigger, but it will run without any need of runtime dlls.
Get the "Visual Studio 20xx VC++ Redistributable package" for your version of Visual Studio. Then run on the target machine to install.
Bottom of this page: https://visualstudio.microsoft.com/downloads/
Or bottom of this page for older versions of Visual Studio: https://visualstudio.microsoft.com/vs/older-downloads/
I've had the same problem, mainly because originally when compiling something with C++ and turning it into an exe file, it's still gonna be an exe file that depends on libraries from C++.
But according to asd plourgy, who had a good idea to change the value of the runtime library, I wanted to share with whoever seeks knowledge how I solved it:
Go to your Visual Studio Code and follow these steps:
Click on Project
Properties
Scroll out C/C++
All Options
runtime library
Change value to: "Multithreaded-DLL (/MD)".
And that should do the trick. Afterwards, you have to obviously
save
debug
create new(exe)
open cmd and run the exe to make sure it works.
My System is: Windows 10
Here are a few pictures to make the steps easier, it's in german though:
step1:
step2:
step3:
step4:
step5:

Debug build can't find debug runtime DLLs

I have a Visual Studio 2008 (SP1) program, debug build, 32bit, that can't seem to find the debug runtime DLLs (multithreaded debug DLLs).
But the crazy thing is, depends.exe shows the requisite DLLs as being present (and also missing). It actually looks like it's trying to load those DLLs twice.
Below is a link to a screenshot from depends.exe showing what I'm talking about - analysing a library that is part of the solution.
When I launch the program, I get "The program can't start because MSVCP90D.dll is missing from your computer. Try reinstalling the program to fix this problem."
If I go into the sxs directory and copy the "missing" DLLs into the same directory as the binary, the program runs.
The application manifest specifies the correct DLL versions (as evidenced by them being found by depends.exe). I've checked the manifests of that version of the runtime, and to my untrained eye it looks legit.
The binary itself shows the same problem as the DLL examined in the linked image, but also with MSVCP90D.DLL missing (and yet present).
I've tried building with internal/external manifests, turning incremental linking off and on, as suggested elsewhere, all to no avail. I would try linking a non-DLL runtime, however the libraries I am using are shared across many tens of solutions, so changing the way they are built isn't really an option (unless of course that turns out to be the only solution due to a known issue that my googling didn't turn up).
I've tried running sxstrace, but most of the time the output is empty (!), when it isn't empty it shows no errors.
I tried using windbg, but got nowhere as I'm not particularly experienced with the tool and wasn't sure what I was looking for.
I'm running on 64bit windows 7. One of my early thoughts was that having VS2005, 2008 and 2010 all installed on my box was causing some weird issues, but I've found no evidence to support that supposition.
(PS. Looks like similar issue as msvcp90d.dll is missing msvcr90d.dll which as far as I can see didn't actually get solved, and also mentions C# - my project is pure C++).
PPS. Looks like similar issue as "application configuration is incorrect" and "side-by-side configuration is incorrect" running VS2008 64-bit debug build
However that problem was related to 3rd party libraries and 64 bit builds.
In addition the "solution" to copy the "missing" DLLs manually from SxS to the bin directory (which as is mentioned above does the trick) is not a solution at all - at best it's a work-around.
The redisributable does not include the debug DLL files. You need to install Visual Studio to get them.
"Debug versions of an application are not redistributable and none of the debug versions of the various Visual C++ dynamic-link libraries (DLLs) are redistributable. Debug versions of an application and Visual C++ libraries can only be deployed to another computer internal to your development site for the sole purpose of debugging and testing your application on a computer that does not have Visual C++ 2005 installed."
Here is the topic on msdn about runing debug builds "Preparing a Test Machine To Run a Debug Executable" (solutions and examples are provided):
http://msdn.microsoft.com/en-us/library/aa985618(v=vs.90).aspx
You can choose your version of visual studio (from 2005 up to 2013).

Error "msvcr100.dll" (only on Windows 7 & Vista) even AFTER statically linking (/MT)

I have a simple dll that is being injected into a target process using MS detours. The process doing the injecting is C# .net application.
Both the DLL and the detours library have been statically linked (/MT option).
However when I try to inject the dll into a target program on a client's machine I get error "msvcr100.dll" is missing" error. Now I open the dll w/ depends and there is no dependency on "msvcr100.dll".
Even weirder this issue only happens when the client is vista x64 or windows 7 x64. The dll is successfully injected on windows xp x32 and windows 7 x32 systems.
Any ideas on what bug in visual studio is indicating a dependency on a library not being used?
On edit:
Looks like someone else had the same issue ... never resolved.
Compiled .dll files requiring msvcr100.dll to load
For the record installing Visual studio 2010 C++ redistributable on client machine "solves" the issue however I hoped to avoid that dependency by statically linking.
You might be able to figure out what's going on my attaching (pre-injection) the cdb debugger to the process on a machine where msvcr100.dll is loaded (with the DLL installed). Use the
sxe ld:msvcr100
command to break when that DLL is loaded (I'm not 100% sure if that's the exactly correct syntax). Once it's loaded, you might be able to figure out why by looking at the call stack. If not, try setting a breakpoint on everything in that module:
bm msvcr100!*
and see who's calling it. That should give you a really good idea why it's being loaded.
So I never did discover exactly what the issue is but on a hunch I tried running the application (exact same build w/ mscvr100.dll error) on another Windows 7 machine and it worked fine.
I reinstalled Windows 7 on the "problem" machine and the same build works fine without error. In my google searching I came across a report of another person having this issue after uninstalling Visual Studio. I know for a fact that Visual Studio was installed on the "problem" Windows 7 machine at one time and was currently uninstalled.
If this happens to someone else I would recommend try running the binary on a machine that has never had visual studio installed. If it works without issue then likely there is some issue related to VS uninstall.

visual c++ 2008 release problem

I've made a simple C++ program in VC++ 2008 Pro and it runs fine in the pc I used to develop it but when I run it in a pc without VC++ installed, it just gives me a
"This application has failed to start because the application configuration is incorrect"
error. I fixed this before by statically linking my project but now when I try to do /MT or /MTD , I get a slew of link errors and it just won't go...
I've also tried installing the vs 2008 redist package too, still doesn't work.
Check my answer here.
Essentially the C/C++ runtimes are now deployed as side-by-side win32 assemblies. The embedded manifest in the compiled EXE will determine what dlls it binds to from the C:\Windows\WinSxS folder.
One question: is this a release or debug build? I would try a release build to make sure it's not a debug runtime issue (which I believe won't be present on a PC that doesn't have visual studio on it).

Visual C++/Studio: Application configuration incorrect?

My C(++) program, written and compiled using Visual C(++)/Visual Studio, runs fine on my own machine, but refuses to run on another machine. The error message I get is "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."
If you write a C++ program, it links dynamically to the C Runtime Library, or CRT for short. This library contains your printf, your malloc, your strtok, etcetera. The library is contained in the file called MSVCR80.DLL. This file is not by default installed on a Windows system, hence the application cannot run.
The solution? Either install the DLL on the target machine through VCREDIST.EXE (the Visual C++ Redistributable Package), or link to the CRT statically (plug the actual code for the used functions straight into your EXE).
Distributing and installing VCREDIST along with a simple application is a pain in the arse, so I went for the second option: static linking. It's really easy: go to your project's properties, unfold C/C++, click Code Generation, and set the Runtime Library to one of the non-DLL options. That's all there is to it.
The problem here is a missing DLL dependency, such as the CRT (C Runtime Library). A good tool for diagnosing this sort of problem is Dependency Walker (depends.exe), which you can find here:
http://www.dependencywalker.com/
You would run this program on the computer that generates the error message you posted, and use it to open the exe that's generating this error. Dependency Walker will quickly and graphically indicate any DLLs that are required but not available on the machine.
Chances are high that you miss the runtime libraries of Visual Studio (CRT amongst others), you can either get rid of those dependencies (link statically) or install the VC redist packages on the target computer.
Depending on the Visual C++ version you use, you have to install different packages :
Visual C++ 2005
Visual C++ 2005 SP1
Visual C++ 2008
Warning : those packages only contain release versions of the libraries, if you want to be able to distribute debug builds of your application you'll have to take care of the required DLL yourself.
It is much the simplest to link to the runtime statically.
c++ -> Code Generation -> Runtime Library and select "multi-threaded /MT"
However, this does make your executable a couple hundred KByte larger. This might be a problem if you are installing a large number of small programs, since each will be burdened by its very own copy of the runtime. The answer is to create an installer.
New project -> "setup and deployment" -> "setup project"
Load the output from your application projects ( defined using the DLL version of the runtime ) into the installer project and build it. The dependency on the runtime DLL will be noticed, included in the installer package, and neatly and unobtrusively installed in the correct place on the target machine.
The correct VC Redist package for you is part of your Visual Studio installation. For VC 8, you can find it here:
\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86
POSSIBLE SOLUTION........
EDIT: (removed most of my post)
Long story short, I was having similar problems, getting the "Application Configuration Incorrect" messages, etc etc.
Depends.exe was only finding ieshims.dll and wer.dll as possible issues, but this is not the problem.
I ended up using the Multithreaded (/mt) compile option.
What HAS worked though, as a workable solution, is making an installer with InstallShield.
I've selected several merge modules in installshield builder and this seems to have fixed my problem. The modules selected were:
VC++ 9.0 CRT, VC++ 9.0 DEBUG CRT, and the CRT WinSXS MSM merge module.
I'm pretty sure its the WinSXS merge module that has fixed it.
DEBUG CRT: I noticed somewhere that (no matter how hard I tried, and obviously failed thus far), my Release version still depended on the DEBUG CRT. If this is still the case, the InstallShield merge module has now placed the DEBUG CRT folder in my WinSXS folder :) Being somewhat of a novice with VC++ I assume that this would normally be used to distribute debug versions of your programs to other people. To test if this is what fixed my problem I removed the DEBUG CRT folder from the WinSXS folder and the application still worked. (Unless something is still running in the background etc etc - I'm not that into it)
Anyway, this has got things working for me on an XP SP3 fully updated machine, and also on a VMWare XP SP3 machine with the bare bones (.net 3.5 and VC++ 2008 RTM basically) - and also on a mate's XP machine where it previously wasn't working.
So give these things a try, you might have some luck.
First thing you must use
#define _BIND_TO_CURRENT_VCLIBS_VERSION 1
or add _BIND_TO_CURRENT_VCLIBS_VERSION=1 to the preprocessor directives.
The problem is related to binding and the manifest types, you can find more http://www.nuonsoft.com/blog/2008/10/29/binding-to-the-most-recent-visual-studio-libraries/
By doing this your application will run with a larger range of runtime libraries versions.
Often times this error is the result of attempting to run the debug version of an application that uses .NET. Since the .NET redistributable package doesn't include the debug versions of the dlls that are installed with Visual Studio, your application will often get this error when running it on any other machine that doesn't have Visual Studio installed. If you haven't already, try building a release version of your application and see if that works.
Note also - that if you change to static runtime, you will have to do the same for MFC if your app uses MFC. Those settings are in properties->Configuration/General
I ran into this problem and was able to fix it very simply.
Visual studio gives you the option (on by default) to build a manifest for each build.
The manifest was put in the release folder, but it was a different release folder than the exe.
Even when using the setup utilities it was not packaged.
You should look for a file names something like myprogram.exe.indermediate.manifest
If this is in the same folder as the exe (and you have all the dlls) it should run