How to Compile CPP File to EXE

First you need to get a C++ compiler., Start a new project in Visual C++., Copy and paste all of the .cpp files into the "Source Files" directory, and copy-paste all the .h files (if there are any) into the "Header Files" directory., Build and...

9 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: First you need to get a C++ compiler.

    One of the best for Windows machines is the free Microsoft Visual C++ 2012 Express.
  2. Step 2: Start a new project in Visual C++.

    This is pretty simple.

    Click the "New Project" button in the top left, then follow the steps to make an "Empty Project".

    Then name it, and on the next pop-up hit "Finish". , Rename the main .cpp file (the one that contains "int main()" in it) to the name of the project that you chose.

    The external dependencies file will fill itself , Press the key after you have finished all of the above and the program will be created. , Navigate to the "Projects" file that Visual C++ installs all of the programs to (in Windows 7, it will be in your Documents).

    It will be in the file with the name you gave it earlier, under the "Debug" directory. , Double-click on the .exe file to run it, and if everything went well, the program should work fine.

    If it doesn't, try going through the steps again. , C++ programs built using Visual Studio require them.

    You won't need it on your machine because it gets installed with Visual Studio.

    But you can't expect your clients to have it.

    Download Link: http://www.microsoft.com/en-us/download/details.aspx?id=30679
  3. Step 3: Copy and paste all of the .cpp files into the "Source Files" directory

  4. Step 4: and copy-paste all the .h files (if there are any) into the "Header Files" directory.

  5. Step 5: Build and compile.

  6. Step 6: Find the exe file.

  7. Step 7: Test it.

  8. Step 8: If you want the program to run on another computer as well

  9. Step 9: that computer must have VC++ Runtime libraries installed.

Detailed Guide

One of the best for Windows machines is the free Microsoft Visual C++ 2012 Express.

This is pretty simple.

Click the "New Project" button in the top left, then follow the steps to make an "Empty Project".

Then name it, and on the next pop-up hit "Finish". , Rename the main .cpp file (the one that contains "int main()" in it) to the name of the project that you chose.

The external dependencies file will fill itself , Press the key after you have finished all of the above and the program will be created. , Navigate to the "Projects" file that Visual C++ installs all of the programs to (in Windows 7, it will be in your Documents).

It will be in the file with the name you gave it earlier, under the "Debug" directory. , Double-click on the .exe file to run it, and if everything went well, the program should work fine.

If it doesn't, try going through the steps again. , C++ programs built using Visual Studio require them.

You won't need it on your machine because it gets installed with Visual Studio.

But you can't expect your clients to have it.

Download Link: http://www.microsoft.com/en-us/download/details.aspx?id=30679

About the Author

J

Jacob Russell

Specializes in breaking down complex creative arts topics into simple steps.

40 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: