14

以前は Debian/Ubuntu ディストリビューションにパッケージをインストールしていましたが、今はバージョン 8.*gccをインストールする必要があります。g++CentOS リポジトリにはバージョン 4.* しかありません。それらを手動でインストールする正しい方法は何ですか?

4

3 に答える 3

30

CentOS 8 already comes with 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

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

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

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

scl enable devtoolset-8 -- bash

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.

于 2019-03-25T20:23:26.733 に答える