How to Start Programming in C++ in Visual Studio

As you start getting familiar with programming in C++, you may find yourself wanting a more robust environment where you can play with code and run programs. Some programmers prefer using a text editor like Brackets or Atom to develop, testing their code through the command prompt. However, you may be looking for something a little more user-friendly, with enhanced features like a debugger, and an ability to see your file hierarchy – which is especially useful for larger projects. For many, this results in using an IDE (Integrated Development Environment). What’s cool about IDE’s is that you can run, compile, execute, and debug code all from one piece of software. If you have decided to look for an IDE, you may be astonished at just how many IDE’s there are. Which one should you pick?

The truth is, it’s all up to your preference. Personally, I really like using Visual Studio. I like that it comes with a compiler, which can eliminate a lot of issues, especially when you’re first getting started. Not only that, Visual Studio is extremely versatile, with support ranging from Virtual Reality development with C#, to having C++ and Python support, to app development. It’s a great one-stop-shop for your development needs, and although it’s bulky, it can be a great place to get started.

To follow along with me, I’ll be assuming you’ve already installed Visual Studio with all the default settings. I’m working with the 2017 version.

Create a New Project

The first thing you’ll want to do is create a new project, which can be found under File > New > Project. This will open up a new window where you can choose what kind of project you’d like to create.

2018-02-09

When you click on Project, a new window will open up. In the sidebar, click on C++. Choose Windows Console Application, and name your project. You can also create a git repository from here, but more on that later. Click Ok.

2018-02-09 (4)

Start Coding!

You’ll notice a default C++ file already has been created for you. Here, you can start editing! I inserted a basic C++ program to get us started.

2018-02-09 (5)

Run your Program

After you’ve finished editing, you simply go to Debug > Start without Debugging. Another window will open up with your creation.

2018-02-09 (6)

And that’s all there is to it! What are you still reading this for? Go try it out!

 

Advertisement
,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: