Category: C++

Added: 18th of October 2020

Viewed: 213 times

Install Visual Studio Code in Kubuntu, Ubuntu and Ubuntu based distributions. Compile and execute C++ script

This tutorial works in Ubunbu, Kubuntu, Xubuntu, Lubuntu, Ubuntu Mate and other Ubuntu based distributions. The tutorial also works in Linux Mint and other Debian based distributions.

Visual Studio Code 1.35 icon

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

Kubuntu, Visual Studio Code launcher
Visual Studio Code start page

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

Visual Studio Code, extensions tab

Once installed goto File >> Open and select myfirstscript.cpp that we created earlier.

Visual Studio Code, open your C++ script

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.

Visual Studio Code, C++ script in terminal window





Other Tips & Tutorials

C++

Basic user input and output using C++ in Linux

Posted: 19th of December 2020

Views: 89

C++

Install Visual Studio Code in Kubuntu, Ubuntu and Ubuntu based distributions. Compile and execute C++ script

Posted: 18th of October 2020

Views: 213

C++

Create a simple c++ script using Ubuntu and other Ubuntu based distributions

Posted: 17th of October 2020

Views: 198