刚拿到一台操作系统时,会使用GCC编译来编译代码,可是此时可能会提示gcc命令不能用,主要是因为系统没有安装。
1.在线安装
执行命令
yum install gcc-c++
2.但有时候无法连接外网的情况下,可以用系统的rpm包进行安装。
在实际的安装过程中和系统版本无太大关系,过程是一致,到这个地址
http://vault.centos.org/6.3/os/x86_64/Packages/ 下载自己对于版本的rpm包即可
本系统需要如下包:
ppl-0.10.2-11.el6.x86_64.rpm
、
cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
mpfr-2.4.1-6.el6.x86_64.rpm
、
cpp-4.4.6-4.el6.x86_64.rpm
kernel-headers-2.6.32-279.el6.x86_64.rpm
glibc-headers-2.12-1.80.el6.x86_64.rpm
glibc-devel-2.12-1.80.el6.x86_64.rpm
libstdc++-devel-4.4.6-4.el6.x86_64.rpm
gcc-4.4.6-4.el6.x86_64.rpm
gcc-c++-4.4.6-4.el6.x86_64.rpm
安装流程如下所示:
[root@localhostgcc_rpm]#rpm-ivh
ppl-0.10.2-11.el6.x86_64.rpm
warning:ppl-0.10.2-11.el6.x86_64.rpm:HeaderV3RSA/SHA256Signature,keyIDc105b9de:NOKEY
Preparing...###########################################[100%]
1:ppl###########################################[100%]
cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
warning:cloog-ppl-0.15.7-1.2.el6.x86_64.rpm:HeaderV3RSA/SHA256Signature,51)">1:cloog-ppl###########################################[100%]
mpfr-2.4.1-6.el6.x86_64.rpm
warning:mpfr-2.4.1-6.el6.x86_64.rpm:HeaderV3RSA/SHA256Signature,51)">1:mpfr###########################################[100%]
cpp-4.4.6-4.el6.x86_64.rpm
warning:cpp-4.4.6-4.el6.x86_64.rpm:HeaderV3RSA/SHA1Signature,51)">1:cpp###########################################[100%]
kernel-headers-2.6.32-279.el6.x86_64.rpm
warning:kernel-headers-2.6.32-279.el6.x86_64.rpm:HeaderV3RSA/SHA1Signature,51)">1:kernel-headers###########################################[100%]
glibc-headers-2.12-1.80.el6.x86_64.rpm
warning:glibc-headers-2.12-1.80.el6.x86_64.rpm:HeaderV3RSA/SHA1Signature,51)">1:glibc-headers###########################################[100%]
glibc-devel-2.12-1.80.el6.x86_64.rpm
warning:glibc-devel-2.12-1.80.el6.x86_64.rpm:HeaderV3RSA/SHA1Signature,51)">1:glibc-devel###########################################[100%]
gcc-4.4.6-4.el6.x86_64.rpm
warning:gcc-4.4.6-4.el6.x86_64.rpm:HeaderV3RSA/SHA1Signature,51)">1:gcc###########################################[100%]
libstdc++-devel-4.4.6-4.el6.x86_64.rpm
warning:libstdc++-devel-4.4.6-4.el6.x86_64.rpm:HeaderV3RSA/SHA1Signature,51)">1:libstdc++-devel###########################################[100%]
gcc-c++-4.4.6-4.el6.x86_64.rpm
warning:gcc-c++-4.4.6-4.el6.x86_64.rpm:HeaderV3RSA/SHA1Signature,51)">1:gcc-c++###########################################[100%]
[root@localhostgcc_rpm]#gcc –version
查看版本
按照上面顺序安装完之后查看版本,有版本信息输出,安装完成。