通常所说的GCC是GUN Compiler Collection的简称,是由GNU开发的编程语言编译器。GNU编译器套件包括C、C++、 Objective-C、 Fortran、Java、Ada和Go语言前端,也包括了这些语言的库。GCC的初衷是为GNU操作系统专门编写的一款编译器。GNU系统是彻底的自由软件。大家可以进入查看相关信息。
Ubuntu中安装软件一般有两种方式:
sudo apt install build-essential
build-essential是一整套工具,执行完后,就完成了gcc,g++,make的安装。
gcc -v
若出现gcc版本号,则证明安装成功
这里列举一个我在安装过程中遇到的问题,在执行完sudo apt install build-essential后,出现了:
hemu@ubuntu:~$ sudo apt install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
build-essential : Depends: libc6-dev but it is not going to be installed or
libc-dev
Depends: g++ (>= 4:4.4.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
出现这个问题一般是因为软件源不匹配的问题,建议更改下载的源:
cd /etc/apt
sudo cp sources.list sources.list.bak
sudo vim sources.list
将sources.list的内容更换为阿里源:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
然后更新一下软件:
sudo apt-get update
sudo apt-get upgrade
然后在安装gcc。
本文地址:https://blog.csdn.net/qq_44947550/article/details/107347125
如对本文有疑问, 点击进行留言回复!!
[杭电多校2020]第一场 1004 Distinct Sub-palindromes
Swift -- 将本地生成的UIImage进行持久化保存(存到文件中fileManager.createFile)
网友评论