Updated On: Tutorial updated and rechecked on 5th of December 2023
Views: 3,681
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.
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.