How to Run C++ in Visual Studio Code on Windows 10 2022 Best IDE

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys if you're looking for how you can run c and c plus plus programs in your favorite visual studio code then you are in the right place watch this video until the end because i'm about to show you step by step process to configure visual studio code for running c and c plus programs correctly and i'm also gonna show you how you can run two sample c plus plus program in visual studio code on windows 10 machine so without further ado let's get started firstly we have need to download and install the c plus compiler the best suited for our job is bingw to download it copy this link i have provided this link in the video description now open up your favorite web browser i am using google chrome here and then paste the copied link into the search bar and hit enter this is the third party page for downloading mingw for windows operating system the best part about this site is that it contains self extracting archive for mingw which is really super easy to install now click on this mingw download link and now you can see our mingw.exe file is started downloading here it's around 45 megabyte file it will take some time to download all depend on your internet connection speed our mingw installer exe file is downloaded successfully now click on show in folder let me expand the window now simply right click on this file and select open here cancel all of this except c colon slash and click on extract button and it will start the extraction and installation process let me minimize all the windows so that we can focus on installation part it will take some time to complete now we need to add path in environment variables so that we can access g plus plus and gcc in visual studio code for that double click on this pc and open local disk c here open newly installed mingw directory then open bin folder and click on address bar and finally copy this path now again go back to this pc and right click on this free space and select properties here click on environment variable button select path and then click on edit button and then click on new and paste mingw path in this blank field then click on ok button ok again and okay again good job now let's check is this working or not for that first let me close unnecessary windows now click on windows button then type cmd and then click on command prompt here type g plus plus space minus minus version and press enter and if you see something like this then congratulations you have successfully installed mingw compiler on your windows 10 machine correctly now i'll show you how you can download and install visual studio code on windows 10. you can skip this part if you already installed visual studio code and directly jump to c configuration part copy this link and open your browser and paste the copyright link into the address bar and hit enter this is the official page for downloading visual studio code to download it click on this blue download for windows button [Music] and now you can see our vs code user setup exe file started downloading here it's around 61 megabyte file at this time of recording it will take some time to download our vs code installer setup file is downloaded successfully click on this down arrow and select show in folder we need to install this file simply double click on this file and it will start the setup wizard let me close all other windows so that we can focus on installation part here accept the license agreement and click on next button just leave it as default for the destination folder just make sure you have at least 250 mb of free disk space available and click on next button need to change anything here just click on next check create a desktop icon and again click on next and finally click on install button it will take some time to install and finally click on finish button and it's all done you have successfully installed visual studio code on windows 10 you can open the visual studio code by pressing windows button and write visual studio code and click on visual studio code app ok now let's configure visual studio code for running c and c plus programs for that firstly we need to install code runner extension in visual studio code press this button in the search bar type code runner [Music] and choose this first option now press on the small green stall button to run the code you can press control plus alt plus n and to stop the code from running you can press ctrl alt m now in search bar type c c plus plus and select the first option and again press on this small install button it will install c plus plus debugging and code browsing support now let's write some basic c program in the visual studio code for testing now click on the new file button and click on file and select save as choose your preferred directory i am selecting desktop here give a name to a file i am writing subscribe dot cpp just don't forget to add dot cpp at the end of the file for c plus program otherwise it won't work and then click on save let me quickly type a basic c program that prints subscribers to run the program you can press ctrl alt n or simply click on this small play button it gives an error this is just because we did not save the changes before running the program to fix this all you need to do is save your program and now click on play button and it works see subscribers is printed here let's create another program which takes input from the user for that click on file and click on new file now click on save as i'll name this file input program dot cpp and then click on save ok here i am writing the code for program that asks the user for its first name and last name and finally prints full name of the user back to the output console [Music] so our code is running but we are not able to input our first name here so this is a problem we can solve this problem by clicking on file then select preference then select settings type run in terminal here and go down a little bit and find code runner run in terminal and check this box and cancel the settings and return back to our program and restart visual studio code now run the code by pressing run play button let me type my first name here now the last name now you can see my full name is printed here so this is how you can run c plus program in visual studio code if you are interested in learning more about c plus plus language then be sure to check out our beginner c plus plus course at the first link in the description subscribe and turn on the notifications so you don't miss more videos helping you to learn how to code and become a successful programmer and i'll see you in the next video take care
Info
Channel: Tech Decode Tutorials
Views: 1,048,846
Rating: undefined out of 5
Keywords: visual studio code, visual studio, vscode, visual studio code c++, run c++ vscode windows 10, how to run c++ in visual studio code on windows 10, how to run c++ in vscode, mingw64, install mingw on windows 10, g++ vscode windows 10, Run C++ Code in windows 10 Visual Studio Code, c++ on windows 10, run c++ on windows 10, c++ compiler, visual studio code c++ windows 10, best ide, techdecode, mingw, input vscode, cpp, how to run c++ in visual studio code, run c++ in visual studio code
Id: jvg4VtYEhKU
Channel Id: undefined
Length: 9min 5sec (545 seconds)
Published: Mon Oct 12 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.