Gcc installed under ubuntu

In ubuntu install gcc

    第一次写blog,多多包涵!

gcc mounting step

Ado, gcc steps are as follows:

1. sudo apt update
2. sudo apt install build-essential

If you want to verify that the gcc compiler has been installed, you can use gcc --versionto print gcc version number.

Installation issues that may arise

Question one:

Description of the problem: According to the above-described step of inputting a command line still unable to install Build-Essential , as shown:

That is:

现在没有可用的软件包 build-esential,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,
或者只能在其他发布源中找到
E: 软件包 build-esential 没有可供安装的候选者

Solution:

This ubutun official default update source soruces.list related.

We only need to modify soruces.list file, add third-party update source in which to solve the problem. Since soruces.list default file is read-only, so we have to change its permissions.

1. cd /etc/apt
2. ll
3. sudo chmod 777 soruces.list


And then locate the file on your computer, and add the following to the end of the data source file to resolve the issue.

deb http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse
deb-src http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse
deb http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted
deb http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted

Question two:

Description of the problem: the implementation sudo apt install build-essentialsometimes have problems as shown below:

img

Solution: You can use the following command line to force unlock:

1. sudo rm /var/cache/apt/archives/lock
2. sudo rm /var/lib/dpkg/lock

Thanks to the help provided by the following bloggers

https://blog.csdn.net/darling_forever/article/details/80116116

https://blog.csdn.net/gsh_hello_world/article/details/70227852

Guess you like

Origin www.cnblogs.com/study-JD/p/12036451.html