centos 下安装g++

参考文章:https://blog.csdn.net/wh921021/article/details/8765044

在centos下安装g++,如果输入 yum install g++,那么将会提示:

[plain]  view plain  copy
  1. [root@hugo hugo]# yum install g++  
  2. Loaded plugins: fastestmirror, refresh-packagekit, security  
  3. Loading mirror speeds from cached hostfile  
  4.  * base: centos.ustc.edu.cn  
  5.  * extras: centos.ustc.edu.cn  
  6.  * updates: centos.ustc.edu.cn  
  7. Setting up Install Process  
  8. No package g++ available.  
  9. Error: Nothing to do  

因为在centos下g++安装包名字叫做:gcc-c++

所以应该输入 yum install gcc-c++,即可。

[plain]  view plain  copy
  1. Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Resolving Dependencies
    --> Running transaction check
    ---> Package gcc-c++.x86_64 0:4.8.5-28.el7_5.1 will be installed
    --> Processing Dependency: libstdc++-devel = 4.8.5-28.el7_5.1 for package: gcc-c++-4.8.5-28.el7_5.1.x86_64
    --> Processing Dependency: libstdc++ = 4.8.5-28.el7_5.1 for package: gcc-c++-4.8.5-28.el7_5.1.x86_64
    --> Processing Dependency: gcc = 4.8.5-28.el7_5.1 for package: gcc-c++-4.8.5-28.el7_5.1.x86_64
    --> Running transaction check
    ---> Package gcc.x86_64 0:4.8.5-16.el7 will be updated
    ---> Package gcc.x86_64 0:4.8.5-28.el7_5.1 will be an update
    --> Processing Dependency: libgomp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
    --> Processing Dependency: cpp = 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
    --> Processing Dependency: libgcc >= 4.8.5-28.el7_5.1 for package: gcc-4.8.5-28.el7_5.1.x86_64
    ---> Package libstdc++.x86_64 0:4.8.5-16.el7 will be updated
    ---> Package libstdc++.x86_64 0:4.8.5-28.el7_5.1 will be an update
    ---> Package libstdc++-devel.x86_64 0:4.8.5-28.el7_5.1 will be installed
    --> Running transaction check
    ---> Package cpp.x86_64 0:4.8.5-16.el7 will be updated
    ---> Package cpp.x86_64 0:4.8.5-28.el7_5.1 will be an update
    ---> Package libgcc.x86_64 0:4.8.5-16.el7 will be updated
    ---> Package libgcc.x86_64 0:4.8.5-28.el7_5.1 will be an update
    ---> Package libgomp.x86_64 0:4.8.5-16.el7 will be updated
    ---> Package libgomp.x86_64 0:4.8.5-28.el7_5.1 will be an update
    --> Finished Dependency Resolution


    Dependencies Resolved


    ============================================================================================================
     Package                      Arch                Version                        Repository            Size
    ============================================================================================================
    Installing:
     gcc-c++                      x86_64              4.8.5-28.el7_5.1               updates              7.2 M
    Installing for dependencies:
     libstdc++-devel              x86_64              4.8.5-28.el7_5.1               updates              1.5 M
    Updating for dependencies:
     cpp                          x86_64              4.8.5-28.el7_5.1               updates              5.9 M
     gcc                          x86_64              4.8.5-28.el7_5.1               updates               16 M
     libgcc                       x86_64              4.8.5-28.el7_5.1               updates              101 k
     libgomp                      x86_64              4.8.5-28.el7_5.1               updates              156 k
     libstdc++                    x86_64              4.8.5-28.el7_5.1               updates              303 k


    Transaction Summary
    ============================================================================================================
    Install  1 Package  (+1 Dependent package)
    Upgrade             ( 5 Dependent packages)


    Total download size: 31 M
    Is this ok [y/d/N]: y
    Downloading packages:
    Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
    (1/7): cpp-4.8.5-28.el7_5.1.x86_64.rpm                                               | 5.9 MB  00:00:00     
    (2/7): gcc-c++-4.8.5-28.el7_5.1.x86_64.rpm                                           | 7.2 MB  00:00:00     
    (3/7): gcc-4.8.5-28.el7_5.1.x86_64.rpm                                               |  16 MB  00:00:01     
    (4/7): libgcc-4.8.5-28.el7_5.1.x86_64.rpm                                            | 101 kB  00:00:00     
    (5/7): libgomp-4.8.5-28.el7_5.1.x86_64.rpm                                           | 156 kB  00:00:00     
    (6/7): libstdc++-4.8.5-28.el7_5.1.x86_64.rpm                                         | 303 kB  00:00:00     
    (7/7): libstdc++-devel-4.8.5-28.el7_5.1.x86_64.rpm                                   | 1.5 MB  00:00:01     
    ------------------------------------------------------------------------------------------------------------
    Total                                                                        10 MB/s |  31 MB  00:00:03     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Updating   : libgcc-4.8.5-28.el7_5.1.x86_64                                                          1/12 
      Updating   : libstdc++-4.8.5-28.el7_5.1.x86_64                                                       2/12 
      Installing : libstdc++-devel-4.8.5-28.el7_5.1.x86_64                                                 3/12 
      Updating   : cpp-4.8.5-28.el7_5.1.x86_64                                                                                                                                                     4/12 
      Updating   : libgomp-4.8.5-28.el7_5.1.x86_64                                                                                                                                                 5/12 
      Updating   : gcc-4.8.5-28.el7_5.1.x86_64                                                                                                                                                     6/12 
      Installing : gcc-c++-4.8.5-28.el7_5.1.x86_64                                                                                                                                                 7/12 
      Cleanup    : gcc-4.8.5-16.el7.x86_64                                                                                                                                                         8/12 
      Cleanup    : libstdc++-4.8.5-16.el7.x86_64                                                                                                                                                   9/12 
      Cleanup    : libgcc-4.8.5-16.el7.x86_64                                                                                                                                                     10/12 
      Cleanup    : cpp-4.8.5-16.el7.x86_64                                                                                                                                                        11/12 
      Cleanup    : libgomp-4.8.5-16.el7.x86_64                                                                                                                                                    12/12 
      Verifying  : libgomp-4.8.5-28.el7_5.1.x86_64                                                                                                                                                 1/12 
      Verifying  : libgcc-4.8.5-28.el7_5.1.x86_64                                                                                                                                                  2/12 
      Verifying  : libstdc++-devel-4.8.5-28.el7_5.1.x86_64                                                                                                                                         3/12 
      Verifying  : gcc-4.8.5-28.el7_5.1.x86_64                                                                                                                                                     4/12 
      Verifying  : cpp-4.8.5-28.el7_5.1.x86_64                                                                                                                                                     5/12 
      Verifying  : libstdc++-4.8.5-28.el7_5.1.x86_64                                                                                                                                               6/12 
      Verifying  : gcc-c++-4.8.5-28.el7_5.1.x86_64                                                                                                                                                 7/12 
      Verifying  : libgcc-4.8.5-16.el7.x86_64                                                                                                                                                      8/12 
      Verifying  : libstdc++-4.8.5-16.el7.x86_64                                                                                                                                                   9/12 
      Verifying  : libgomp-4.8.5-16.el7.x86_64                                                                                                                                                    10/12 
      Verifying  : cpp-4.8.5-16.el7.x86_64                                                                                                                                                        11/12 
      Verifying  : gcc-4.8.5-16.el7.x86_64                                                                                                                                                        12/12 


    Installed:
      gcc-c++.x86_64 0:4.8.5-28.el7_5.1                                                                                                                                                                 


    Dependency Installed:
      libstdc++-devel.x86_64 0:4.8.5-28.el7_5.1                                                                                                                                                         


    Dependency Updated:
      cpp.x86_64 0:4.8.5-28.el7_5.1       gcc.x86_64 0:4.8.5-28.el7_5.1       libgcc.x86_64 0:4.8.5-28.el7_5.1       libgomp.x86_64 0:4.8.5-28.el7_5.1       libstdc++.x86_64 0:4.8.5-28.el7_5.1      


    Complete!

猜你喜欢

转载自blog.csdn.net/poetry_and_distance/article/details/80390042
今日推荐