C++: Using Visual Studio for C++

This entry is part 1 of 61 in the series C++

In an earlier post in Learn C, I have worked out a simple guide on compiling a C program using Visual Studio.

For compiling C++ using Visual Studio, we use very similar steps to compile and run a program.

If you have not downloaded C++, please download it from this link.

Launch the visual studio and click on New Project. The following screenshot will appear.


You can use the default name and click on OK.

In the Welcome To Win32 Application Wizard, click on Next.


Click On Empty Project as shown in the screenshot above.

An empty project with the following screen shot will be shown.


Notice the Solution Explorer on the right of the screen.

Now we want to create a file and put our source code there.

Right click on Source File in Solution Explorer.  Then Add -> New Item.

Name our first C++ program as Hello.cpp as shown in the screenshot below.


Click on Add.

Paste the code below to Hello.cpp.

#include <iostream>

int main()
	std::cout << "Hello World";

Click on Local Windows Debugger to run the program.


In our code, the cout is a standard string output in C++.  Notice the line getchar().  This is a C code and I have used it so that the console will prompt us to type in a character allowing us to see the Hello World text in the console.


Series Navigation
C++: The language >>

Leave a comment

Leave a Reply