In this article, I will take you through how to use C++ in the VS Code. Now you can easily use other IDE like Turbo C++ or Dev C++ but they are not as good as compared to the Visual Studio Code.
But to use the Visual Studio Code for C and C++ you need to perform some steps to install the compiler into your system. So let’s see how to install and setup the C++ compiler for VS Code.
Also, Read – Machine Learning Full Course for free.
Setting Up C++ in VS Code
To use C or C++ in the Visual Studio Code you need to download and install the MinGW Compiler which is the official compiler for C and C++. So you can easily download and install the MinGW Compiler from here.
Now after downloading the MinGW compiler let’s see how we can set up and install it our systems for using it in the Visual Studio Code for C++. Simply open the MinGW software and go to the basic setup and mark the three options as shown below for installation and simply proceed further.
After the installation, you need to open your command prompt and then you need to execute two simple commands for the installation of C++ compiler (gcc and g++):
- mingw-get install gcc
- mingw-get install g++
After executing the above two commands you are ready with the compiler in your system for C++, now the next thing to do is to set up the VS Code for C++.
Simply open your VS Code and go to the extensions and search for C/C++ and install the first extension that you see:
Then search for the C/C++ Compile Run and install the first extension that you see:
After installing both the extensions above you are now ready to write and run your first C++ program in the Visual Studio Code. Simply wite the program below and run the file:
So after performing all the steps that I have shown above I hope you can easily use the C++ programming language in the VS Code.
I hope you liked this article on how to set up and install the C++ programming language for Visual Studio Code. Feel free to ask your valuable questions in the comments section below.