一、安装前准备
1. gcc and g++分别是GNU的c & c++编译器。
2. 官方网址:https://gcc.gnu.org/
3. 查看是否安装
[root@ecs-test1 ~]# gcc -v
-bash: gcc: command not found
[root@ecs-test1 ~]# g++ -v
-bash: g++: command not found
或者:
[root@ecs-test1 ~]# rpm -q gcc
package gcc is not installed
[root@ecs-test1 ~]# rpm -q gcc-c++
package gcc-c++ is not installed
二、安装gcc、g++编译器
1. 安装gcc、g++
yum install gcc
yum install gcc-c++
2. 查看是否安装成功
[root@ecs-test1 ~]# rpm -q gcc
gcc-4.8.5-28.el7_5.1.x86_64
[root@ecs-test1 ~]# rpm -q gcc-c++
gcc-c++-4.8.5-28.el7_5.1.x86_64
或者:
[root@ecs-test1 ~]# which gcc
/usr/bin/gcc
[root@ecs-test1 ~]# which g++
/usr/bin/g++