How to Install VS Code or VS Code Insiders
You have to download Visual Studio Code directly from the official website: https://code.visualstudio.com/.
If you want, you can also install VS Code Insiders, and the same process is applicable for that as well.
Visual Studio Code Insiders is actually the “Insiders” build of Visual Studio Code, which contains all the latest features that are shipped daily. You can think of VS Code as the stable release and the VS Code Insiders as the Insiders release of that.
If you want to experience the latest updates instantly, then you might also try Visual Studio Code Insiders (I use it myself). For downloading VS Code Insiders, you can visit the official website for VS Code Insiders here: https://code.visualstudio.com/insiders/
Make sure to download the exact file for your operating system.
The installation process is pretty basic. But I am going to show you all the steps sequentially. For now, I am going to show you the installation process using VS Code Insiders, but everything you will see here is going to be exactly the same for VS Code as well.
Make sure to click the box on the “I accept the agreement ” box and click on Next.
Keep everything as it is. Do not change anything from here.
Click Next. Again, simply click Next.
Make sure to add the checkmark (✔) on all of the boxes. Then click on Next.
Click on Install.
It might take a little time to finish the installation.
Click on Finish.
Congrats – you’ve successfully installed VS Code/VS Code Insiders on your system. Now, cheers! 🥂
How to Prepare VS Code/VS Code Insiders For C and C++ Code
First, open VS Code or VS Code Insiders.
Go to the Extension tab. Search for “C” or “C++” and install the first one that is already verified by Microsoft itself.
Also, install C/C++ Extension Pack. It should also be verified by Microsoft.
Then you have to search for Code Runner and install the extension as well.
Now, we need to change some settings.
Click the gear box (It is called the Manage section), and then click Settings. Alternatively, you can also use the shortcut keys Ctrl
+ ,
. You need to replace the Ctrl
key with the Command key for Mac.
In the search bar, type “Run code in terminal” and press the Enter key.
Scroll down a little bit until you find Code-runner: Run In Terminal
. Make sure that the box is checked (✔).
Now you need to restart your VS Code/VS Code Insiders. Simply close and reopen the program.
How to Test Your Code
Simply open VS Code/VS Code Insiders, open any folder, and create any file with the extension .c
for the C file and .cpp
for the C++ file.
After writing your code, you can run the code directly using the play button you’ll find in the upper right corner.
It will compile and then run the code directly. After running a code, the code runner button would be set default to run directly. So, your computer is 100% ready for compiling and running any C/C++ programming code.