How to Set up Visual Studio Code for C and C++ Programming [ with MSYS2 ]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I'll show you how to run C or C++ code in Visual Studio code on windows so let's get started in order for you to get started you need to come to this website called code dovisual studio.com download and from here we will download and install the actual Visual Studio code editor so I'm on windows so we will click on this Windows button here and you can see the download will get started so after uh it finishes downloading you can just click on it and start installing it it's a fairly simple installation process just click the next next next until you are done after you have done that step what we have to do is we need to come to this page docs and right here on the left side you can see the C++ option and then you'll see this GCC on Windows option click there and right here this is the installation guide of setting up C++ with our Visual Studio code so we need to follow all these steps so let's get started we'll start by installing the mww 64 tool chain and we can do that by first installing the myis 2 so let's just click on myis 2 here and if I scroll down you can see this download the installer just click there and the installer will start downloading let's just wait so it's downloaded I'll click on it and install my sis2 on my computer so let's click on next next next and it will get installed after the install is finished click on finish and you can see this is the interface that we will see if you don't see this just go to the search and search for M and you should see this msis 2 click here and you have the same thing so let's just close this one for now let's work with this one and let's go back to this tab and here we need to do the next step which is copy this command so I'm just going to copy it and go back to myis and just paste the command and hit enter so I'll press enter here you need to press you need to type in y and then press enter so this command will actually download the MW on my windows and also install it and all the required packages that we need in order to run C++ so yeah let's just wait this might take a while based on your internet connection so now we are done the myis has installed all the packages and everything that it needed to install so the next step is that we need to add this path to our EnV variables but I would suggest go to the search bar and search for MS and you'll see something like this msis 2 msis and right click click on open file location and again right click and click on open file location and now you are inside the msis directory where you have installed the msis but here we now need to go to this uh UCR 64 directory and then bin then you can just click on this bar right here and just right click and copy the path now now close the file explorer and go back and search for Environ and you will see something like this edit the system environment variables and in here click on environment variables click on path and click on new and just paste what you just copied so this is the path that we had copied so simply paste it click okay click okay click okay now let's go back to visual studio code and uh here we need to do one last thing which is is we need to install the C++ extension I'll search for extension if you don't see this what you need to do is you need to go to this extensions Tab and then search for C++ and you can see this one from the Microsoft I'm going to install it after that I can simply go to my file and you can see we have this play button now and I can click on it and I get this error g++ is not recognized as an internal or external command to fix this error I can simply first close this Visual Studio code and again open it so as you can see the vs code has restarted and I have this file main.cpp which actually prints out subscribe to my channel so let's just run the file and see if it runs and immediately you can see this time I get these three options I'm going to choose the first one and you can see it's saying start building and we get the message subscribed to my channel let's change this message to like this video let's run it again and you can see the message change to like this video so yeah this is it this is how you run your uh C++ code in Visual Studio code and if you have any questions you can comment down below I'll see in the next one till then peace out
Info
Channel: TheBinaryBits
Views: 29,860
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, learninglad c++, learninglad mingw
Id: NYBFShZXSpQ
Channel Id: undefined
Length: 4min 39sec (279 seconds)
Published: Sun Dec 10 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.