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

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

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.

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

How to run a C++ application built in Visual Studio 2015 on another machine [duplicate]

This question already has answers here:
using static libraries instead of dynamic libraries in opencv
(5 answers)
Closed 6 years ago.
I have been developing some programs in C++ using Open CV on Visual Studio 2015 and am trying to run the executable produced from building Visual Studio on another machine, but on the new machine it informs me that multiple .dll files are missing. Is there such a way to compile it in Visual Studio that it will not require these .dll files, or is there a way to have all of the .dll files on the new machine?
I am running in x86 Release and have changed the C / C++ code generation to just Multi Threaded.
The Open CV I have installed is 3.0, does this cause issues with using Visual Studio 2015?
Cheers
You need to install the Visual Studio redistributables on the machine where the application is going to run : http://www.microsoft.com/en-us/download/details.aspx?id=48145
Either have your installer install the redist. Ask the user to do it. Or bundle the libraries manually with your executable.

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).

this program can't start because libeay32.dll is missing from your computer [duplicate]

This question already has an answer here:
Settings of Visual Studio to remove dependency on a dll file during runtime
(1 answer)
Closed 8 years ago.
I don't need libeay32.dll in my project. I have already added ssleay32.lib in my application. This was working fine in visual studio 2010 version of my app. When I ported it in visual studio 2013 this error occurred. Where do I remove the settings so that my application doesn't search for libeay32.dll? My project built successfully. When I try to run the exe file or run the project than this shows up.
It is library for SSL. You probably need to install OpenSSL or just download it from some website and copy it to system folder.