https://access.redhat.com/solutions/22999
Is gcc is part of standard RHEL installation?
SOLUTION 已验证 - 已更新 2018年四月2日10:48 -
环境
- Red Hat Enterprise Linux
问题
- Is
gccis part of standard RHEL installation? - How to install compilers
gccand 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:
# yum install gcc
And if you would like to install development tools such as autoconf, automake, flex, c++ compiler, etc:
# yum grouplist
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:
# yum groupinfo "Development tools"
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
# yum groupinstall "Development Tools"
诊断步骤
How to verify your gcc installation:
$ 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:
$ 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:
$ vi redhat.c
#include<stdio.h>
int main(void){
printf("Hello Red Hat!\n");
return 0;
}
Now, let's compile to generate an executable file:
$ gcc redhat.c -o redhat
Execute the program:
$ ./redhat
Hello Red Hat!
RHEL中GCC安装与测试

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

被折叠的 条评论
为什么被折叠?



