如何在CentOS上安装GCC/G ++ 8 [英] How to install GCC/G++ 8 on CentOS

查看:409
本文介绍了如何在CentOS上安装GCC/G ++ 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经在Debian/Ubuntu发行版上安装软件包,但是现在我需要安装gccg++版本8. *. CentOS资料库中只有4. *版本.手动安装它们的正确方法是什么?

I'm used to install packages on Debian/Ubuntu distributions, but now I need to install gcc and g++ version 8.*. There is only version 4.* in CentOS repositories. What's the correct way to install them manually?

推荐答案

CentOS 8已随附GCC 8.

CentOS 8 already comes with GCC 8.

在CentOS 7上,您可以从Developer Toolset安装GCC 8.首先,您需要启用软件集合存储库:

On CentOS 7, you can install GCC 8 from Developer Toolset. First you need to enable the Software Collections repository:

yum install centos-release-scl

然后,您可以安装GCC 8及其C ++编译器:

Then you can install GCC 8 and its C++ compiler:

yum install devtoolset-8-gcc devtoolset-8-gcc-c++

要切换到默认gccg++为该GCC版本的shell,请使用:

To switch to a shell which defaults gcc and g++ to this GCC version, use:

scl enable devtoolset-8 -- bash

您需要将所有命令包装在scl调用下,以便此命令执行的进程环境更改会影响所有子shell.例如,您可以使用scl命令来调用执行所需操作的Shell脚本.

You need to wrap all commands under the scl call, so that the process environment changes performed by this command affect all subshells. For example, you could use the scl command to invoke a shell script that performs the required actions.

这篇关于如何在CentOS上安装GCC/G ++ 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆