How to share program to run for a friend?

I just finished writing a small potion store program that just opens the terminal and prompts the user to enter information.
I was curious how to share this code for someone else? I found the exe file in my visual studio project folder for the code, but when launching it by itself on another pc it does not seem to do anything.

Do I need to include all of the code files for it to run properly?

The other computer likely doesn't have the MS C/C++ runtime files (DLLs) that reduce the size of the executable. Those files are automatically installed with VS.

If you are using a recent version of Visual Studio (2015-2022) download the runtime redistributable for the computer. ARM, x86 or x64.
You have to deploy the EXE file and all of the DLL files that your EXE file might depend on.

Tools like Dependencies can help a lot to figure out the required DLLs:

It is possible to avoid the dependency on the Visual Studio runtime DLLs and the UCRT DLLs by linking your EXE file against the "static" runtime instead of the "shared" (DLL) one - at the cost of a bigger EXE file:

Furthermore, 64-Bit EXE file only runs on 64-Bit Windows. 32-Bit EXE file runs on 32- and 64-Bit Windows.

Also note that programs compiled by recent versions of Visual Studio only run on Windows Vista and later. There is no more support for Windows XP at this point. Visual Studio 2017 was the last one that still could target Windows XP; and even Visual Studio 2017 required selecting the special "v141_xp" toolset.

Yet another thing to consider: If you compile your program with SSE, SSE2, AVX or AVX2 instructions enabled, then it will crash when you try to run it on a CPU that does not support the required instruction set!


A good way to test the deployment of your program is using a "fresh" (untouched) Windows in a VM.

You can grab VM images for testing here:
Last edited on
be sure to compile it in release mode before you give it out. This helps get rid of dependencies on debug libraries and extra junk.
Topic archived. No new replies allowed.