How to Compile CPP File to EXE

by Dinesh 2012-05-22 09:49:31

Compile CPP File to EXE:

1. First you need to get a C++ compiler. One of the best for Windows machines is the free Microsoft Visual C++ 2010 Express.

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

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

4. Build and compile. Press the [F7] key after you have finished all of the above and the program will be created.

5. Find the exe file. 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.

6. Test it. 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.

7. Exe file will be created in source folder with same file.

Tagged in:

1038
like
0
dislike
0
mail
flag

You must LOGIN to add comments