Ubuntu安装GCC编译器
程序员文章站
2022-06-23 19:21:09
文章目录GCC简介安装步骤常见问题GCC简介通常所说的GCC是GUN Compiler Collection的简称,是由GNU开发的编程语言编译器。GNU编译器套件包括C、C++、 Objective-C、 Fortran、Java、Ada和Go语言前端,也包括了这些语言的库。GCC的初衷是为GNU操作系统专门编写的一款编译器。GNU系统是彻底的*软件。大家可以进入GCC官网查看相关信息。Ubuntu中安装软件一般有两种方式:源码包,安装源码包更适合系统,源码包一般为C语言编写,需要在系统中先安...
GCC简介
通常所说的GCC是GUN Compiler Collection的简称,是由GNU开发的编程语言编译器。GNU编译器套件包括C、C++、 Objective-C、 Fortran、Java、Ada和Go语言前端,也包括了这些语言的库。GCC的初衷是为GNU操作系统专门编写的一款编译器。GNU系统是彻底的*软件。大家可以进入GCC官网查看相关信息。
Ubuntu中安装软件一般有两种方式:
- 源码包,安装源码包更适合系统,源码包一般为C语言编写,需要在系统中先安装GCC编译器,然后才能编译安装源码包。
- 二进制包,在Ubuntu中为.deb包,安装过程简单。
安装步骤
- 在终端输入
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
上一篇: 大寒节气有什么吃的你了解吗?一起来看看吧
推荐阅读
-
mysql 5.7.17 安装配置方法图文教程(ubuntu 16.04)
-
ASP.NET Core部署前期准备 使用Hyper-V安装Ubuntu Server 16.10
-
linux系统ubuntu18.04安装mysql 5.7
-
Linux(Ubuntu)下Mysql5.6.28安装配置方法图文教程
-
Linux(Ubuntu)下mysql5.7.17安装配置方法图文教程
-
mysql 5.7.16 安装配置方法图文教程(ubuntu 16.04)
-
阿里云服务器ECS上ubuntu安装nginx后默认站点页面打开错误,显示无法访问此网站
-
VMware 12 下 Ubuntu 16.04 安装图文教程
-
在 Ubuntu 上安装 Protobuf 3 的教程详解
-
protobuf简单介绍和ubuntu 16.04环境下安装教程