Question:
How to send someone my C++ program (Visual Studio 2012) ?
Yassodude
2013-10-18 13:23:16 UTC
I can't believe no one is explaining this simply on the internet. I have a very simple C++ project I want to show to my friend. The only library I included is is . Most of the solutions I saw said things about changing your library to a static library which kept my program from compiling in the first place. I don't mind the program increasing in size and automatically including the library, and I can't find the option to compile a release version.

Bottom line, I want to send a perfectly working .exe file to my friend.

Thanks in advance.
Three answers:
t
2013-10-18 15:04:01 UTC
Using static linking worked for me.



- File > New > Project... > Win32 Console Application > Name: HelloWorld > OK

- In the toolbar at the top, click the dropdown that says "Debug" and choose "Release"

- Project > HelloWorld Properties > Configuration Properties > C/C > Code Generation > Runtime Library: Multi Threaded (/MT)

- Build > Build Solution (to show that menu, use Tools > Settings > Expert Settings, or alternatively just run by pressing the green triangle in the top toolbar)

- The executable is located in HelloWorld\Release\HelloWorld.exe
?
2013-10-18 21:29:01 UTC
On the tool bar there should be an option to pick a debug or a release build. Change it to release and then compile the program (f5).



Look in the project folder for a folder called "msw", the .exe for your program should be in there.



With visual studio 2012 all you should need to do is send them the .exe.



Depending on the version of windows they have and what else they have installed they may get a missing DLL error when they first try to run it. If so then they need to install the Visual Studio 2012 redistributable package. You can find that here: http://www.microsoft.com/en-us/download/details.aspx?id=30679
Chris
2013-10-18 20:31:16 UTC
if you have g you can go into command prompt and type:

g "name of program".cpp -o "Name of executable".exe



then you can send the compiled version to your friend


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...