• 【亲测】<g++/gcc>CentOS下g++: command not found问题的解决(c++环境安装)


    CentOS下g++: command not found问题的解决

    版权声明:本文章是作者辛勤书写的成果,如需转载,请与作者联系,并保留作者信息以及原文链接,谢谢~~ https://blog.csdn.net/blueheart20/article/details/58173190

    1. 问题的提出

       在安装extundelete的过程中,发现在configure过程中,出错了,具体的错误信息如下:

    1.  
      configure:2865: g++ --version >&5
    2.  
      ./configure: line 2867: g++: command not found
    3.  
      configure:2876: $? = 127
    4.  
      configure:2865: g++ -v >&5
    5.  
      ./configure: line 2867: g++: command not found
    6.  
      configure:2876: $? = 127
    7.  
      configure:2865: g++ -V >&5
    8.  
      ./configure: line 2867: g++: command not found
    9.  
      configure:2876: $? = 127
    10.  
      configure:2865: g++ -qversion >&5
    11.  
      ./configure: line 2867: g++: command not found
    12.  
      configure:2876: $? = 127
    13.  
      configure:2896: checking whether the C++ compiler works
    14.  
      configure:2918: g++ conftest.cpp >&5
    15.  
      ./configure: line 2920: g++: command not found
    16.  
      configure:2922: $? = 127
    17.  
      configure:2960: result: no
    18.  
      configure: failed program was:
    19.  
      | /* confdefs.h */
    20.  
      | #define PACKAGE_NAME "extundelete"
    21.  
      | #define PACKAGE_TARNAME "extundelete"
    22.  
      | #define PACKAGE_VERSION "0.2.4"
    23.  
      | #define PACKAGE_STRING "extundelete 0.2.4"
    24.  
      | #define PACKAGE_BUGREPORT "extundelete.sourceforge.net"
    25.  
      | #define PACKAGE_URL ""
    26.  
      | #define PACKAGE "extundelete"
    27.  
      | #define VERSION "0.2.4"
    28.  
      | /* end confdefs.h. */
    29.  
      |
    30.  
      | int
    31.  
      | main ()
    32.  
      | {
    33.  
      |
    34.  
      | ;
    35.  
      | return 0;
    36.  
      | }
    37.  
      configure:2965: error: in `/root/extundelete-0.2.4':
    38.  
      configure:2967: error: C++ compiler cannot create executables
    39.  
      See `config.log' for more details

    经过分析,发现其中的关键错误信息是:

     g++: command not found
    g++马上就脑补为gc++的编译器是不是没有安装呀? 估计是的,按图索骥,安装看看。

    2.  安装以及解决

      由于本人使用的OS环境为centos, 其默认的包管理工具为yum, 故按照依赖包:

    1.  
      yum -y update gcc
    2.  
      yum -y install gcc+ gcc-c++
    执行上述命令之后,可以返现gcc相关命令都按照成功了,故问题解决。

    3. 总结分析

      默认情况下,centos并未按照gcc相关的编译命令,如果在安装软件之时,有时候需要从源代码编译开始,进行安装;此时就需要gcc的命令支持。

  • 相关阅读:
    vue中动态数据使用wowjs显示动画
    vue 切换路由页面不在最顶部
    dp,.单词的划分
    二分建火车站
    .最大上升子序列和
    饥饿的奶牛(不重区间最大值)
    F. 1.小W 的质数(prime)(欧拉筛)
    月月给华华出题
    积性函数
    垒石头(排序+dp)
  • 原文地址:https://www.cnblogs.com/duanweishi/p/9542829.html
Copyright © 2020-2023  润新知