This article was updated and rechecked on 5th of December 2023
Category: C++
Added: 18th of October 2020
Updated On: 5th of December 2023
Viewed: 3,068 times
Related Tips & Tutorials
➔
Create a simple c++ script using Ubuntu and other Ubuntu based distributions, Learning C++
Install Microsoft Visual Studio Code in Kubuntu, Ubuntu and Ubuntu based distributions. Compile and execute C++ script

If you visited my previous tutorial I showed you how to create a simple C++ script, compile and execute this using the linux terminal.
In this tutorial I show you how to install Visual Studio Code, open the same C++ script, compile and execute the code all in one place, avoiding the need to chop and change between your text editor and the terminal.
The first thing to do is download and Install Visual Studio Code by visiting
https://visualstudio.microsoft.com/downloads/
If your using Kubuntu, Ubuntu or other Ubuntu/Debian based distributions select the .DEB package and download.
Once downloaded cd to where the .deb file was downloaded and enter the following command to install.
Replace filename with the file you downloadedb
sudo dpkg -i filename.deb
Once installed, open Visual Studio Code either by searching for the application in your distribution, or my case as I'm using Kubuntu the from the applications > development menu
Inside Visual Studio Code click on the extensions icon, on the left hand side and search for the following extension
C/C++ Compile Run. Click the install button to install the extension
Once installed goto File >> Open and select
myfirstscript.cpp that we created earlier.
Next press F6 to compile and execute the script. You will notice the terminal window appear below your script.
Once finished using the terminal remember to close by clicking on the little trash can, otherwise if you try and rung another script it will say it is already running, in that case you need to close and start visual studio code again.