Hello! 欢迎来到小浪云!


香港云服务器Cannot find a C compiler, aborting


avatar
小浪云 2025-02-08 104


香港云服务器在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 SoftwarFoundation, 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.

相关阅读