Getting Started on Windows with Visual Studio IDE

Getting Started on Windows with Visual Studio IDE
Overview
Difficulty
Beginner
Duration
40m
Students
45
Ratings
5/5
starstarstarstarstar
Description

This course will help you prepare for the Complete C++ Developer learning path and get you set up with the right development environments.

Learning Objectives

  • Set up Visual Studio, VS Code, or Code::Blocks depending on whether you'll be working on Windows, Mac, or Linux as you follow along with the exercises in this course

Intended Audience

  • Beginner coders, new to C++
  • Developers looking to upskill by adding C++ to their CV
  • College students and anyone studying C++

Prerequisites

This is a beginner-level course and so no prior knowledge of C++ is necessary.

Transcript

If you are using a Windows computer, one of the most popular IDEs or integrated development environments is Visual Studio IDE. Specifically, you can download and use the current version of the community edition of Visual Studio IDE. Note that this is a completely different piece of software than Visual Studio Code, a code editor available on all platforms. The examples in this course are done using the Visual Studio Community Edition 2019, but should still be fine for later versions when they are released. If you choose to use a different IDE or code editor, note that some of the steps for pro ject creation, compilation, and debugging may be different, but the actual C++ code should be the same. We need to download and install Visual Studio. You can use your favorite search engine such as Google to search for Visual Studio, and it should be one of the very top options. So, let's go to Chrome over here. Use your browser of choice and your search engine of choice. We have Google right here. So, I'm going to look for Visual Studio, and you will notice that the very top option here is Visual Studio IDE. And if you click on that, there's actually three columns here currently in their current design, this design may be updated or changed over time. So, be ready for that Visual studio, there's Visual Studio code and then there's Visual Studio for Mac. I have a bit of a warning if you're a Mac user. Don't download this, if you're just planning on doing C++ development, because it is not officially supported for C++ development. This is for using what's called the .net core and you would use C# and some other technolo gies related to that. However, they do not have C++ capabilities at least officially. And I'm not going to tell you to do something that's not formally supported. Now, the middle one Visual Studio Code, you may already have it for other software, if you do other software development, and you can continue to use Visual Studio Code if you'd like. For this course though, we're going to use the Visual Studio IDE. This is a full featured IDE to code, debug, test and deploy to any platform. So, if you're on windows, you go to download Visual Studio and select the community 2019 edition. Once you go here, it 'll try to ask you a survey. You may or may not choose to fill it out. I'm just going to hit the X. It will still download the installer which you can see in the lower left-hand corner. I could actually show in folder and you can see in downloads right here. I have Visual Studio community and then there's some build notation here indicating which build it is. So, let's hit 'continue' here, and make sure the installer is up to date itself. This is for managing different versions of Visual Studio and related products, because some people prefer having older versions and newer versions and they do different things with them. Now, you will get workloads here. So, you'll notice that there are multiple options here. Now, normally, I would probably select Desktop.NET Desktop environment as well, but to show you what I'm doing, if you're just doing C++ for now, you can always go back and install other things. So, it's no t that big of a deal. I'm going to select Desktop development with C++. So, right there. And you should be okay with the default stuff that's installed here. This is some additional stuff down here that you may or may not need. But for our purposes, all of this should be more than enough. You can either choose install while downloading or download then install. It doesn't really matter. And we're going to click "install". I just have it on installed while downloading. It will generally give you a total space required, and you'll notice this is around 7 gigabytes for me. If you do not have that available on a disk that you feel safe to install it on, then you may have to choose an alternative, like code blocks, which is indicated in another lecture. So, let's hit "install" and you notice already have 2017 installed and with an update available. This is something I use for a different environment to keep stuff organized. Just so you don't have to watch this download and install, we'll come back as soon as it's done, you can pause, I'll pause and then you can see what we do next. So, I have this right here where the IDE has been installed, and you can launch from here. Or you can just close this once it's done, it may ask you to restart your computer. So, if you want to do that, then you can just pause the video where it's at close down and then come back when you're done. And when you come back, you can type Visual Studio. And as long as you only have one installed, it will look like this. I have mine pinned to the task bar. So, if you click it to open it, it'll look like this when you open it. I will close Chrome for the moment. And let's create a simple program, and just make sure that the installation was successful. So, the code may not make much sense to you yet, but don't worry. This is just a test to make sure that you have everything installed correctly. So, I'm going to go to 'create a new project'. And if I do that, I'm going to make sure that I'm under the languages. You have C++, and then there's empty project right here, and then hit 'Next', and then you can choose a name for the project. I'm just going to call mine 'Test install' and then you can hit 'Create'. You could pick a new location if you wanted to but I'm just going to leave it in the repos right there and hit 'Create.' And then this is what Visual Studio looks like when it first launches. You'll notice there is a solution explorer, yours may be on a different side or you may choose to move it to one side or the other. I usually keep mine docked over here, where you can click and drag it and dock it. But we're going to create a source file under source files. Right click, Add, New Item, and then make sure you're under visual C++ and I want a C++ file. I will name this "main.cpp" right here, and click 'add'. Now, it doesn't have to be named "main.cpp'. If you're coming from Java, you don't have to match the function class name to the file name. There's no rules really about that. But this is just conventional, something that I use. Some people put the name of their file as driver or main program or entry or things like that, that's totally fine. And control zooming with my mouse so you can see the code a little bit better and include iostream using namespace std; for standard. So, that's the first thing you type. We will go over this again in the actual coding sections. But this is just to make sure that you have this installed for now. So, I'm going to type cout, C-O-U-T, two less than signs which are the stream insertion operator. And I'm going to put in double quotes. That's the same key as the apostrophe or the single quote. As a programmer, we don't say apostrophe, we say single quote. It's next to the enter key on a standard keyboard, English keyboard. So, let's put "Hello C++" stream insertion opera tor again and end l for end line and then a semi colon. And the IDE may add some extra space in this code editor right here. And then at the very bottom, although nowadays you don't actually have to do it with main, I put a return zero for main. So, just a couple of lines of actual executable code here and only one is really going to make a difference as far as what it looks like. This is our main function. It's the entry point to our application. And we have this, so it can use cout to print to the console. So, let's see what happens when we run it. So, we're going to run this to test it out. And if it runs, we're all set. First thing we could do if we wanted to is billed solution or you could just go directly to debug start without debugging, and it will build it and then run it. So, I'm just going to first build it though. Build solution, at the bottom here, it says that it succeeded. So, that's good. Now , I go to debug, start without debugging. And this is from the IDE, but the very first part here prints "Hello C++." And the new line character which puts the moves to the next line. Awesome. So that's pretty much it for installation and setup. Enjoy the course.

 

About the Author
Students
297
Courses
20
Learning Paths
4

John has a Ph.D. in Computer Science and is a professional software engineer and consultant, as well as a computer science university professor and department chair.

Covered Topics