Error involving dll when running C++ executable on another computer [duplicate] - c++

This question already has answers here:
Visual C++ executable and missing MSVCR100d.dll
(6 answers)
Closed 8 years ago.
I want to share a simple program I made in VS2010 using C++, but when running on another computer I get an error. Here is the error message:
The program can't start because MSVCR100D.dll is missing from your
computer. Try reinstalling the program to fix this problem.
I have the dll in the same folder, as I thought this would fix it. I'm using the debug executable, and the other computer doesn't have VS2010 installed which is what I think is causing the problem.
Anyone have any solutions?

Target machine needs to have Redistributable Package for Visual C++ 10.0 installed. Download it from here:
http://www.microsoft.com/en-us/download/details.aspx?id=5555
You may also consider reading this section of MSDN to learn more about deployment process:
http://msdn.microsoft.com/en-us/library/zebw5zk9(VS.100).aspx
EDIT:
It seems that I missed that small 'd' in the DLL name. While this solution would be helpful in case of MSVCR100.dll (release version), it won't help you with the debug version, which you linked you application against. That's because debug DLLs are not included in redist packages - they are only shipped with Visual Studio.
Required DLLs (release builds) are placed in (VSInstallDir)\VC\redist(Platform)\Microsoft.VC100.CRT
Their debug versions can be found in (VSInstallDir)\VC\redist\Debug_NonRedist(Platform)\Microsoft.VC100.Debug.CRT.
However, I don't think that making any effort to run debug build is a good solution. Providing release build is probably what you should do.

Related

How to distribute a console application? [duplicate]

This question already has answers here:
Problems with running EXE file built with Visual Studio on another computer
(6 answers)
Closed 2 years ago.
I am new to C++ and recently made a Tic-Tac-Toe game, which is a console application (no graphics). I have built my project in Release mode in Visual Studio 2019. I want this application to be transferred from one computer to another. I have zipped the Release folder of Visual Studio and tried to transfer it into another PC. When I ran it on another PC it failed to work?
I am new to programming, please help.
You don’t mention the exact error, but a first order possibility is a missing dependency.
Odds are you are missing the Visual Studio C++ runtime on the target machine (the one you are coping to). Windows does not install them by default, but Visual Studio does install them.
To download the runtime, go to https://visualstudio.microsoft.com/downloads/ then navigate to “Other tools and frameworks” then “Microsoft Visual C++ Redistributable for Visual Studio“. Select the version that matches your build and download and install it. You can copy the runtime dlls over from your PC, but installing them is generally easier and better for maintenance. If you are using an older version of Visual Studio, the download is normally available, but you’ll have to search for it.
Failing that, you may have another dependency missing. You should look to tools such as Dependency Walker, still available here https://www.dependencywalker.com/.
It must be run on pc's which OS you built on if it doesn't have additional libraries (Not Standart). if you have additional libraries, Add .dll files into release folder.
If you need help on customizing Console, I'll glad to help you on this.

Release C++ code using Visual Studio 2017 [duplicate]

This question already has answers here:
Visual Studio 2017 C++ Exe for any pc (linking vcruntime140.dll)
(2 answers)
Closed 2 years ago.
I have written a C++ project using Visual Studio 2017 in Windows 10. I am trying to run the code in other computers as well.
So, I tried copying the Release folder to another Windows 10 computer. But, when I try to execute the .exe file, it is showing errors: missing dll’s: vcruntime140.dll and ucrtbased.dll.
Please help me in the release process to be followed.
The reason is because your application is dynamically loading the VC runtime which gets installed with the Redistributable package. Typically people can install the Redistributable packages without the full SDK but the easier solution is to just compile your application to statically load the C runtime libraries.
Go to project settings, then C/C++->Code generataion and change your runtime library from /MD to /MT. /MD is dynamic and /MT is static.
Also you can just install the package on your other machine from here https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

Visual c++ problem in compiling native windows 10 application [duplicate]

This question already has answers here:
MSVCP140D.dll missing, is there a way around? [closed]
(2 answers)
Closed 3 years ago.
I'm coding a native C++ application in Vs 2019 that sould be able to run on a freshly configured windows 10 machine.
The problem is that when i run my .exe app on this machine i get missing dlls error such as MSVCP140D.DLL, VCRUNTIME140D.dll etc.
I tried to install the vcredist from MSDN on the guest machine and i also tried changing the "runtime library" from the "code generation" module in the project config.
I also followed some other tutorials that i've read on this platform but i can't find nothing that really works.
I even tried to place the missing dlls in the same directory of the .exe file to register them manually, actually it does not work, but this app i'm developing should be redistributable so the user should have just to execute it.
If i try to compile my program with another compiler such as MinGw it works but i wanted to use the vc++ default compiler if possible.
Is there a way to solve this issue?
Thanks!
Maybe you used MSVCP140.DLL, wihtout the D. the D stands for DEBUG and I don't know if the Debug version version comes with the visual studio redistributable. If you compile in visual studio try to build the Release version, this should work with the DLL´s from the redistributable

Running .exe files on different computers.(visual studios) [duplicate]

This question already has answers here:
How do I determine which c++ redistributables my program needs to run?
(4 answers)
Closed 5 years ago.
I am trying to run a .exe file which was made with visual studios on a different computer. The computer that i made the program on runs fine but if I run it on a different computers it will not run. I get these errors.
The code execution cannot proceed because ucrtbased.dll was not found.
Reinstalling may fix this problem.
and...
The code execution cannot proceed because VRUNTIME140D.dll was not found.
Reinstalling may fix this problem.
Please note I am using C++ to write the code. I downloaded the c++ Redistributable (visual studios 2017) and it still not working.
Thanks.
You need to install the Visual Studio runtime (redistributables) for the VS version used to build the application on the machine where you wish to run it.

How to make an .exe generated by Visual Studio 2013 run in other computers? [duplicate]

This question already has an answer here:
Distributing an exe file compiled with Visual Studio 2013
(1 answer)
Closed 6 years ago.
Greetings to everyone in this forum.
I just finished my mid-term project in Visual Studio 2013 for collegue and my professor want us to give him the .exe of the project. The problem is that it only works in my computer. When I try to open the .exe in other computers, this error shows up:
The program can't start because MSVCP120.dll is missing from your computer. Try reinstalling the program to fix this problem.
I was wondering if there is any way to fix this problem, so that the .exe can work in any computer that run Windows.
I really appreciate any help you can provide.
You are dynamically linking with the C++ runtime libraries meaning you need some extra dlls to go along with your exe. You can either install the VC++ redistributable package (https://www.microsoft.com/en-us/download/details.aspx?id=40784) or static link the libraries.
If you want to keep it down to a single executable I'd suggest the static linking route. In VS2013,
right click on the project in the project explorer and select properties
In the project tree open Common Properties, C/C++, Code Generation.
Find the Runtime Library item in the right pane and change from Multi-threaded DLL to Multi-threaded.
You can do similar for the debug configuration.