How to compile C++ programs using Microsoft Visual Studio?

If you are an engineering student than you should be searching for a good compiler to compile you C++ programs on latest edition of Windows OS. Your college must have asked you to install Turbo C++ on your computer in order to practice your home work but Turbo C++ is now an age old compiler and is not recommended for latest editions of Windows operating systems.

But why use Turbo C++ when you have Visual Studio or its free avatar Visual C++ Express Edition to compile your C++  programs. Compiling your programs on Visual Studio can be a confusing task for first time users but nevertheless it is an easy one. Here are the steps which you should follow to compile your programs in Visual Studio:

1. Firstly you have to download Visual Studio from Microsoft’s official website. If your college is under their dreamspark program than you can get a free full copy of Visual Studio 2010 for learning purpose. But in case your college in not in their list than you can either download a 90 day trial copy of Visual Studio Professional edition from here http://www.microsoft.com/en-us/download/details.aspx?id=16057 or download free Visual C++ express edition from here http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express

 

2. Now open Visual Studio by clicking on its icon. In the home window click on the File –> New –> Project

3. Now after this a windows will open which will ask you the type of the project. Here click on Win32 option under the Visual C++ category in the left sidebar.

4. After this click on the Win32 Console Application in the right side of the same window and input a name and location in the fields given at the bottom of the window.

5. After this a Win32 Application Wizard window will open. Click next on this window. After clicking next, check the box besides the Empty Project option and then click Finish button at the bottom of the window.

6. Now right click on Source Files folder on the left side bar and click Add –> New Item –> C++ File (.cpp). Enter a name for the file in the box at the bottom and click Add button.

7. A new window will open after the above operation. This will be the editor window where you can type your C++ program. After typing you program click on the Debug option in the menu bar and then click Start Debugging option from the drop down menu. After clicking this option you will see the console window with your desired output and if there occurs any error while compiling than it will be notified in a new window.