技术知识库

帮助中心 >  产品文档 >  云服务器 >  Cannot find a C compiler, aborting

在Red Hat系统安装软件的时候,突然提示“Cannot find a C compiler, aborting”。这是因为缺少gcc编译器导致的。

gcc编译器是将源代码处理为机器可认识的二进制文件的重要程序。换言之,如果没有gcc编译器,就不能通过源代码方式来安装程序。一般的系统默认都会安装之,但也有少量系统未安装。



[root@localhost]# ./configure --prefix=/usr/local/axel

Cannot find a C compiler, aborting.

[root@localhost]# gcc --version     //查看gcc版本

bash: gcc: command not found

我们可以自己下载gcc软件包安装,但因为gcc有大量的依赖包,因此推荐使用yum方式来安装。


1,如果系统能连网,直接执行”yum install gcc*”安装gcc即可


2,如果系统不能连网,Red Hat安装光盘里自带了gcc软件包及其相关依赖包,我们只要将本地光盘设置为yum更新源,然后再执行”yum install gcc*”即可。


安装完成以后的检测:



[root@localhost]# gcc --version         //查看c编译器的版本

gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)

Copyright (C) 2006 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

[root@localhost]# g++ --version        //查看c++编译器的版本

g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-48)

Copyright (C) 2006 Free Software Foundation, Inc.

This is free software; see the source for copying conditions.  There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: