Visual Studio C++ 2010. Run exe without redristibutable [duplicate] - c++

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do I make a fully statically linked .exe with Visual Studio Express 2005?
I've noticed that if you try to run a program compiled with VSC++ you need to have the redristibutable insalled. Is there any way to make your exe only need the library you used?

You cannot run a program without parts of the runtime library which is inside the redistributable. However, you can statically link the redist into the exe. See here: C++ executable - MSVCR100.dll not found error

Related

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

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

Visual Studio C++ - How to avoid Visual C++ Redistributable Packages? [duplicate]

This question already has answers here:
How do I make a fully statically linked .exe with Visual Studio Express 2005?
(4 answers)
Closed 6 years ago.
When I run my program on a freshly installed computer, it tells me that Visual C++ Redistributable Package 2015 (namely, MSVCP140.dll) needs to be installed on the computer in order to run my dynamically linked program.
I understand that static linking would solve the problem - however, that just doubles the size of my executable.
Isn't there a way to suppress visual studio features so the redist package is not necessary and still use the visual studio compiler, as I'm not used to the alternatives like mingw etc.
Or does the redist package actually contain the STL? I can hardly imagine that.
AFAIK you only have 2 options :
1. static linking - no dll dependency, but huge size
2. dynamic linking - you need correspond dlls , relativelly small executables.
As for #2 you also have 2 options :
install redist as standalone package
put this dll's in same directory with exe . It's "legal"
from MS stand point. (privat assembly ?)
Hope it helps .
The 'redist packages' contain basically the libraries. If you don't use any library functionality, you will not need them, but otherwise there is no way - you can't call a library function and then don't have it.
That means remove all includes with <>, and you are good.
Note that if you do use library functions, that is hardly an option - you really don't want to recode strlen, fopen, and so on yourself.

How do I build 64-bit binaries [duplicate]

This question already has answers here:
Compile for x64 with Visual Studio?
(2 answers)
Closed 9 years ago.
ALL,
I have MSVC 2010 and currently working on the program in C++.
The current solution I'm building is for x86. Basically I'm just opening the solution inside an IDE and build it.
Now, what do I do if I need to build 64-bit binary. What to change inside solution?
Thank you.
This MSDN explains exactly, step by step, how to set the Visual Studio Solution for x64: MSDN