Download or install C, C++ compiler on Red Hat Enterprise Linux 5 (RHEL)

by Vivek Gite on April 9, 2007 · 59 comments

Q. I have Red hat enterprise Linux 5 installed on one of the production server. However there is no c compiler installed. I need to compile few applications on this box. How do I install C or C++ compiler on Red Hat Enterprise Linux 5? Where can I get / download compile package?

A.In order to compile and use c/c++ under Linux you need following packages
=> autoconf : GNU's Autoconf is a tool for configuring source code and Makefiles.
=> make/automake : A GNU tool for controlling the generation of executables and other
non-source files of a program from the program's source files.
=> GNU GCC C compiler (gcc) : The gcc package contains the GNU Compiler Collection version 4.1
=> GNU GCC C++ compiler (gcc-c++): This package adds C++ support to the GNU Compiler Collection.

You have total 3 options to download and install GCC compiler under Redhat / CentOS / Fedora Linux:
[a] Use GUI tool
[b] Install rpm from CDROM/DVD
[c] Download and install compiler from RHN over internet

Option # 1: Use GUI tool

Use GUI tool called system-config-packages to install gcc. Just type the following command and select gcc and above packages:
$ system-config-packages &

Option # 2: Install rpm from CDROM/DVD

Mount your CD/DVD and install following packages using rpm command.
# rpm -ivh gcc*

Option # 3: Download and install compiler from RHN over internet

You can download and install packages using RHN and yum command:
# yum install gcc gcc-c++ autoconf automake

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 59 comments… read them below or add one }

1 ali110 August 5, 2007

i wont compiler c linux redhat as4

Reply

2 Rajic August 17, 2007

Its Great to use needed this kind of blogs

Reply

3 anas September 2, 2007

Very use full thanks lot

Reply

4 Rod Evans November 22, 2007

This really is one of the clearest and most helpful answers to a tech question that I’ve ever seen. I’ve just taken on a RHEL v5 server and needed gcc installed – ten minutes after finding this site, I have gcc 4.1.2 installed. This must have saved me a few hours of searching and reading install instructions . . .

I found your site through Google but have now bookmarked it and I’ll be back!

Reply

5 ttty December 20, 2007

thanks for the info!

Reply

6 xfgs March 31, 2008

why registration is Required???? if it is free
u will get hit more if u remove this step

Reply

7 zoya August 13, 2008

how would i install c language

Reply

8 karuppu August 23, 2008

hello
thank u

Reply

9 Justin January 16, 2009

thanks for the info! It is very useful!

Reply

10 Nitin February 23, 2009

I have problem in installing *.tar.gz file on my machine…

Reply

11 Nitin February 23, 2009

replay must is very argent for me…

Reply

12 rafael ortega March 15, 2009

in reading your blog i’m as confused and lost as ethernet is to phone transmission; i installed mandriva free and that is the os i’m using at present; i then foolishly bought their powerpack, thinking it would solve the problems that mandriva one was presenting to me; having downloaded it and installed it due to my ignorance in handling this os i made it unusable; i then repeatedly tried to reinstall it only to find that the operating system will not load giving me an error message: fatal error message which i cannot overcome, yet.
can you help?

Reply

13 rafael ortega March 15, 2009

is there anyone there who knows what i can do?

Reply

14 yadav shakti July 8, 2009

where i downloard and installation process

Reply

15 yadav shakti July 8, 2009

from i install the g++ software or c/c++

Reply

16 Raihan Naufal August 20, 2009

thanks a lot bro. this the good article.

Reply

17 vipin August 24, 2009

thanks for the info!

Reply

18 omar August 26, 2009

After typing the following command “$ which gcc” to verify that gcc is installed, the Output was “/usr/bin/which: no gcc in (/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/omar/bin)
” , instead of being “/usr/bin/gcc”. what i have to do now?

Reply

19 kagrrahang November 6, 2009

where download the gcc rpm program package?

Reply

20 noname December 14, 2009

Keep in mind that developer packages (ie compiler tools) are not available for RHEL Desktop Basic, you need at least option Workstation.

Reply

21 velan February 21, 2010

thanks for the info! It is very useful!

Reply

22 sam February 25, 2010

i install gcc-c++ but how open the compiler i want compile a program then what should i do

Reply

23 Sriharsha May 12, 2010

Hi, I want to install c language as same like as in windows. How to install it?

Reply

24 kapil May 19, 2010

i want c/c++ or g++ complier for redhat linux.please send this packege in my mail ID.

Reply

25 Kiran May 27, 2010

I have installed c compiler using method 3 on fedora 11…….But still I can’t able to run C program….using gcc…..

Reply

26 Sriharsha May 28, 2010

Try to export all the header files and it will work. It worked for me.

Reply

27 FSFV Staff June 21, 2010

i will try it for my centos 5

Reply

28 Krishna July 7, 2010

Thanks for the help.

Reply

29 nisamudeen July 14, 2010

Thanks
helpful link

Reply

30 reese August 13, 2010

Hi,

I have a program consists of header files, .cpp, .c, a Makefile and need to include the problem instances file (.tim).

May i know how to compile and run them? From google, i have heard bout the command make. But i have no idea how. Please kindly help..

Thanks..

Regards,
limeng

Reply

31 narahari August 16, 2010

hi i brought new free pardus linux os,,, but it is not having GCC compiler..i want that…please help me. how to buy and install the compiler

Reply

32 vidya April 9, 2011

hi i have installed fedora in my laptop but when i have execute c code in terminal
by using command gcc myprog.c
But it gives an error that gcc command is not found so tell me fast how to install gcc in fedora.Give me reply fast please;

Reply

33 balakrishna` September 29, 2010

i want c and c++ compilers in fedora 13

Reply

34 krishna June 4, 2011

use yum command :
yum install gcc gcc-c++
it may work.i have tested this in my fedora 10.

Reply

35 akshay October 11, 2010

i have a problem that when i type ./a.out for output then some time it runs and some time it shows bash command so wat should i do in order to run program of doublly linked list as it is running in c compiler

Reply

36 Oliver October 13, 2010

Are you kidding? What useful is here? I need to install a C compiler to compile GCC from source. How can I do this?

Reply

37 kpormegbe samuel korbla January 11, 2011

i want to install a compilar

Reply

38 Kshitiz KrAkErZ January 6, 2011

What is here…
I seek the site frm where I can download the gcc compiler with out requiring its repositories as in a single step….
provide that…

Reply

39 ert January 21, 2011

Could I install gcc without internet connection?

Reply

40 ert January 31, 2011

I’ve tried to install gcc 4 to linpus. I type the command on the terminal through directory objdir.
However, I couldn’t finished. the terminal scroll and show, error in path: my documents/gcc4/objdir.
Anyone can tell the steps?

Reply

41 Siddharth Sharma March 26, 2011

Really nice job buddy… Keep it up

Reply

42 gopu March 28, 2011

how to install .so file in suse linux? & flash in firefox plugin?

Reply

43 Tiya June 4, 2011

i have downloaded gcc-4.6.0.tar.bz2 to my desktop in fedora how to install them??

Reply

44 Bogner820 June 24, 2011

I would consider myself a beginner in the Linux world…I know enough to be dangerous. Very clear instructions. Followed Option 3 and had everything installed in about a minute.

Reply

45 Mallesh June 29, 2011

I want compiler gcc software. plz tell perfect link to download.

Reply

46 saraswat July 30, 2011

Hi
I’m using redhat-5,and I face some problem while install vlc or open office ,getting an error acceptable c complier found in $path.

Reply

47 saraswat July 30, 2011

no acceptable c compiler found.

Reply

48 redhattt September 19, 2011

hello,
thanx for the installation steps…but i still have problems installing the gcc. during the configuration it says
checking the correct version of gmp/mpfr/mpc libraries no
but i have already installed gmp mpfr and mpc as per the version mentioned for installation.
thank you

Reply

49 kelvin September 27, 2011

i have installed redhat 5 version in windows 7 using vmware.in it c copiler is working fine.but i cant compile c++ programs in it.what is the reason ?do i have to download anything further ?plz reply fast i am in great need now ,,i wiil be very thankful to u

thanks in advance

Reply

50 Mayuri Popat November 1, 2011

[mayuri@Mayuri Desktop]$ cd ..
[mayuri@Mayuri ~]$ cd omnetpp-4.1
[mayuri@Mayuri omnetpp-4.1]$ ./configure
checking build system type… x86_64-unknown-linux-gnu
checking host system type… x86_64-unknown-linux-gnu
configure: ———————————————–
configure: reading configure.user for your custom settings
configure: ———————————————–
checking for icc… no
checking for gcc… gcc
checking for C compiler default output file name… a.out
checking whether the C compiler works… yes
checking whether we are cross compiling… no
checking for suffix of executables…
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking for icpc… no
checking for g++… no
checking for c++… no
checking for cxx… no
checking for xlC… no
checking whether we are using the GNU C++ compiler… no
checking whether g++ accepts -g… no
checking for g++… not found
configure: error: No C++ compiler found — one is required to build OMNeT++/OMNEST, and also for model development.
[mayuri@Mayuri omnetpp-4.1]$

Reply

51 Mayuri Popat November 1, 2011

i have the same problem..i have installed centos 6.0 along with windows 7…i can complile c programs but not c++ programs…pls help me for this problem as i have to install omnet++ on centos and it does not work without GNU c++ compliler…

Reply

52 jagadeesh November 4, 2011

thanku…. it helps lot

Reply

53 Sadia January 3, 2012

I am using Redhat Enterprize 5. I want to install gcc compiler. I download gcc-4.6.2.tar.bz.i save it on desktop.can anyone help me how do I install this??

Reply

54 Raj January 8, 2012

Hi Friends,

I need to install oracle on Redhat linux 5.
But i don’t have rpm packages ,form where can i down load them and how to install them.
Kindly guide me….

regards,
Raj

Reply

55 Sriharsha Kalluru January 9, 2012

You can download the RPM’s required for the Oracle installation in Linux from the following website.

http://oss.oracle.com/

Reply

56 shubham singhal January 14, 2012

hello all
i’ve used this command
# yum install gcc gcc-c++ autoconf automake
to install gcc compiler in my fedora16 os.
but when i compile and run my first c++ program (helloworld.cpp) using command
gcc input-file.cpp -o output-file (gcc helloworld.cpp -o helloworld)
it gives error
helloworld.cpp:3:18: fatal error: conio.h: No such file or directory
compilation terminated.
please help..!
thank you…

Reply

57 satya January 18, 2012

Hi
i need one help for your side please tell me the where can i downloaded gcc compiler for Rhel5 64 bit and how to install the process i downloaded so many gcc compilers but its not working properly. i downloaded rpm packages its asking dependencies please help me out this problem guys…

Reply

58 satya January 31, 2012

u r sending one link that is not workng fine.

Reply

59 Babu January 27, 2012

The pre-requisite for installing gcc is to have the ‘C’ compiler but on my RedHat 5.4 system, I don’t see the C compiler. Can someone please point how to get “C” compiler?

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">




Previous post:

Next post: