Is gcc is part of standard RHEL installation?

本文详细介绍了如何在Red Hat Enterprise Linux (RHEL)环境中安装GCC编译器及其相关开发工具。通过使用YUM包管理器,可以轻松地安装GCC及必要的组件,如autoconf、automake等。此外,文章还提供了如何验证GCC安装是否成功的方法,包括检查GCC版本和通过创建并编译一个简单的C程序来测试GCC的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://access.redhat.com/solutions/22999

Is gcc is part of standard RHEL installation?

 SOLUTION 已验证 - 已更新 2018年四月2日10:48 - 

English 

环境

  • Red Hat Enterprise Linux

问题

  • Is gcc is part of standard RHEL installation?
  • How to install compilers gcc and test if it is working?

决议

gcc is definitely available in the RHEL channels. However, whether or not it is installed would depend on the packages selected for the installation. Use yum to install gcc:

Raw

# yum install gcc

And if you would like to install development tools such as autoconf, automake, flex, c++ compiler, etc:

Raw

# yum grouplist

Raw

Available Groups:
   Backup Client
   Backup Server
   Client management tools
   Compatibility libraries
   Desktop Debugging and Performance Tools
   Desktop Platform Development
   Development tools  <-----------------------------------------------
   Eclipse
   Emacs
   FCoE Storage Client

Done

If you would like to know what are the basic components in this group packages:

Raw

# yum groupinfo "Development tools"

Raw

Group: Development tools
 Description: A basic development environment.
 Mandatory Packages:
   autoconf
   automake
   binutils
   bison
   flex
   gcc
   gcc-c++
   gettext
   libtool
   make
   patch
   pkgconfig
   redhat-rpm-config
   rpm-build

Raw

# yum groupinstall "Development Tools" 

诊断步骤

How to verify your gcc installation:

Raw

$ whereis gcc
gcc: /usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz

How to see gcc compiler version:

Raw

$ gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
Copyright (C) 2010 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.

Let's create a little program to test if gcc is working:

Raw

$ vi redhat.c

Raw

#include<stdio.h>
int main(void){
    printf("Hello Red Hat!\n");
    return 0;
}

Now, let's compile to generate an executable file:

Raw

$ gcc redhat.c -o redhat

Execute the program:

Raw

$ ./redhat
Hello Red Hat!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值