Install vscode code editor under ubuntu

1. Install gcc (preparation before installation)

Installing gcc under ubuntu reports an error:

sudo apt get install gcc

Waiting for cache lock: Unable to acquire lock /var/lib/dpkg/lock-frontend. Lock is being held by process 6809 (unattended-upgr) 

Method 1: No solution

sudo rm /var/lib/dpkg/lock

Way 2:

sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

2. Install vscode

sudo snap install code –classic

 

Successful installation

3. Find and add the plug-in in the ubuntu installation list

4. Edit and compile the code

gcc hello.cpp -o hello

Install gcc 's c++ compiler.

sudo apt-get install build-essential gdb

The executable file compiled by gcc can be run on ubuntu ( host x86 ).

reference

【1】 Get Started with C++ on Linux in Visual Studio Code

【2】  Snap installation vscode in Linux environment_sudo snap install --classic code_Just a little timid blog-CSDN blog

 【3】

Ubantu reports an error: Waiting for cache lock: Unable to obtain lock /var/lib/dpkg/lock-frontend. Lock held by process 3228 (aptd)_Waiting for cache lock: Unable to acquire lock /var/lib/dpkg/lock-frontend. _I am a salted fish blog-CSDN blog

sudo rm /var/lib/dpkg/lock

Guess you like

Origin blog.csdn.net/heda3/article/details/132766092