在 CentOS 下安装 gcc

你可以使用下面的命令:yum install gcc-c++输出内容如下:[code][root@cn sphinx-2.0.1-beta]# yum install gcc-c++
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • addons: mirrors.cat.pdx.edu
  • atomic: www4.atomicorp.com
  • base: mirrors.ecvps.com
  • extras: mirror.chpc.utah.edu
  • updates: mirror.chpc.utah.edu
    Setting up Install Process
    Resolving Dependencies
    –> Running transaction check
    —> Package gcc-c++.i386 0:4.1.2-50.el5 set to be updated
    –> Processing Dependency: libstdc+±devel = 4.1.2-50.el5 for package: gcc-c++
    –> Processing Dependency: libstdc++ = 4.1.2-50.el5 for package: gcc-c++
    –> Processing Dependency: gcc = 4.1.2-50.el5 for package: gcc-c++
    –> Running transaction check
    —> Package gcc.i386 0:4.1.2-50.el5 set to be updated
    –> Processing Dependency: cpp = 4.1.2-50.el5 for package: gcc
    –> Processing Dependency: libgcc >= 4.1.2-50.el5 for package: gcc
    —> Package libstdc++.i386 0:4.1.2-50.el5 set to be updated
    —> Package libstdc+±devel.i386 0:4.1.2-50.el5 set to be updated
    atomic/filelists_db | 726 kB 00:00
    base/filelists | 2.9 MB 00:00
    extras/filelists_db | 197 kB 00:00
    updates/filelists_db | 2.0 MB 00:00
    –> Running transaction check
    —> Package cpp.i386 0:4.1.2-50.el5 set to be updated
    —> Package libgcc.i386 0:4.1.2-50.el5 set to be updated
    –> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size

Installing:
gcc-c++ i386 4.1.2-50.el5 base 3.4 M
Installing for dependencies:
libstdc+±devel i386 4.1.2-50.el5 base 2.8 M
Updating for dependencies:
cpp i386 4.1.2-50.el5 base 2.7 M
gcc i386 4.1.2-50.el5 base 5.2 M
libgcc i386 4.1.2-50.el5 base 96 k
libstdc++ i386 4.1.2-50.el5 base 362 k

Transaction Summary

Install 2 Package(s)
Upgrade 4 Package(s)

Total download size: 14 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): libgcc-4.1.2-50.el5.i386.rpm | 96 kB 00:00
(2/6): libstdc+±4.1.2-50.el5.i386.rpm | 362 kB 00:00
(3/6): cpp-4.1.2-50.el5.i386.rpm | 2.7 MB 00:00
(4/6): libstdc+±devel-4.1.2-50.el5.i386.rpm | 2.8 MB 00:00
(5/6): gcc-c+±4.1.2-50.el5.i386.rpm | 3.4 MB 00:00
(6/6): gcc-4.1.2-50.el5.i386.rpm | 5.2 MB 00:00

Total 8.1 MB/s | 14 MB 00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : libgcc 1/10
Updating : libstdc++ 2/10
Updating : cpp 3/10
Updating : gcc 4/10
Installing : libstdc+±devel 5/10
Installing : gcc-c++ 6/10
Cleanup : libgcc 7/10
Cleanup : libstdc++ 8/10
Cleanup : cpp 9/10
Cleanup : gcc 10/10

Installed:
gcc-c++.i386 0:4.1.2-50.el5

Dependency Installed:
libstdc+±devel.i386 0:4.1.2-50.el5

Dependency Updated:
cpp.i386 0:4.1.2-50.el5 gcc.i386 0:4.1.2-50.el5
libgcc.i386 0:4.1.2-50.el5 libstdc++.i386 0:4.1.2-50.el5

Complete!
[root@cn sphinx-2.0.1-beta]#[/code]