How to Set up Visual Studio Code for C and C++ Programming

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to learning lad and in this video we will see how we can set up the visual studio code for writing and executing the C++ programs in order to continue with this video you need to install C and C++ toolset for that in Windows it can install mingw and then you need to download and install Visual Studio code I have already made two separate videos explaining how we can install these two programs and I have explained everything step by step I'm gonna put the link of those videos in the description box and also I'm gonna add a card so if you don't have these programs installed then you can watch those videos install them and then you can continue with this video so now first let us open up the Visual Studio code you can click on the start button and you can find the Visual Studio code shortcut click on it to open visual studio code it will take you to the welcome screen now here in the left hand side you can see extensions just click on it to expand it and here we need to install a couple of extensions one is the C and C++ extension you can search for it or it will appear in this extensions list automatically it is updating here but I'm gonna search for it C C++ and here make sure that you are installing the extension developed by Microsoft so this first result I'm gonna click on it now we need to click on this install to install this C C++ extension it provides the language support for C and C++ to Visual Studio code it includes some features like intelligence and debugging wait for the extension to install completely in the bottom right you can see the steps happening wait for it to completely installed okay now this extension has been installed completely now let us install one more extension and the extension that we have to install is called as core runner this extension will help you to run C and C++ program easily just by clicking on a single button here you have to search for code runner and you can see the first option click on it and install this extension by clicking on that install option and wait for the installation to finish okay now this extension has been installed and it is been enabled globally now what we can do is we can restart the Visual Studio code so I'm going to close it and I'm going to open it up again okay now we are back in the welcome screen now let us set up the workspace so the first thing that we do is we will add a folder to our workspace and here click on the file button and go to add folder to workspace click on that you can create a folder anywhere in your file system and you can add that to workspace here I'm going to create that in my desktop I'm gonna create a new folder in here new folder and I'm gonna call it as C C++ and after that I'm gonna select the folder and I'm gonna add it okay now you guys can see here the folder that we have created is displayed in here now whenever we create a file inside this folder it will be there now if you want you can save the workspace for that you have to go to file and click on save workspace as and you can give a name let us say I'm gonna save this workspace in my desktop and I'm going to call it as C cpp programming and click on save so now you guys can see we have the CCPP programming workspace and inside that workspace we have this folder C C++ okay now let us create a file inside this folder C C++ so select this folder and then click on this new file option and give a name for your file so let us say test dot C okay now you know we have opened this test or C file in here let me create a simple program okay now here I have written a very simple program if you are a beginner if you are what in this as part of my C and C++ video series then you don't have to write this program just to make the settings that I tell you to make okay now here I have written the program now in order to run this program I have some options like I can click on this run code button or I can use the shortcut ctrl alt N or I can right-click here and I can click on run code and when I do that here in the output tab you can see the output which is hello world it is okay but the problem is in your program if you have to take an input from the user then from this output tab we can't really provide the input that's because this output tab is read-only just to demonstrate that I'm going to make this program to take some user input okay now I have modified this program to take some user input if you understand the C language then it's okay now if I try to run this code then as you guys can see it is not working here in this output tab because it is read-only and in this program I'm trying to take some user input and since this output tab is read-only it's not working so we need to have a solution for this one so I'm gonna stop this by pressing alt control am and the setting that we have to make is you need to click on file and you have to go to preferences and you need to select settings and here you need to click on extensions and if you scroll down then you guys can see run code configuration click on that and again scroll down and here you need to check run in terminal so check this one and after that press ctrl s save it and close the settings ok now come back to the code and right click run code now the code will run in the terminal and it says enter age I'm going to say 30 and says it is 30 so if you are a beginner if you don't know how to write this program or if you don't understand this program then it's okay just to follow that setting that I have told you to make that is make sure that run in terminal checkbox is selected so you don't have to write this code in your editor and you have to try it just to demonstrate this why we have to make that change I just you know wrote this code and explained it so this is it guys for this video if you like this video hit the like button you put on like it it that is like button if you want to say something then read that in the comment box for more tutorials like this do subscribe to the channel thank you for watching I'll see you later in the next video
Info
Channel: LearningLad
Views: 3,732,063
Rating: undefined out of 5
Keywords: Visual Studio Code, VS Code, C Programming, C++ Programming, Set Up Visual Studio Code for C C++, C Ide, C++ ide, C Compiler, C++ Compiler, computer programming, programming for beginners, C Video Tutorial, C++ video tutorial
Id: 77v-Poud_io
Channel Id: undefined
Length: 7min 21sec (441 seconds)
Published: Tue Mar 31 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.