Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My Linux machine has the following definition:

  • RHEL 5.4
  • Kernel release.2.6.18

but I don’t have the g++ command. (I need to write c++ programs under Linux)

For example:

 [root@linux /etc]# g++
 -bash: g++: command not found

I also tried the following:

 yum install gcc
 loaded plugins: security
 Setting up Install Process
 No package g++ available.
 Nothing to do

My question: How do I install/download the g++ command? From where can I get g++?

I have the gcc command but this is only for C programs, not C++.

  [root@linux /]# which gcc

From man page I see: (I'm not sure if gcc also compiles C++)

  [root@linux /]# man gcc
  GCC(1)                                GNU                               GCC(1)

  gcc - GNU project C and C++ compiler
share|improve this question
up vote 2 down vote accepted

Install the gcc-c++ package.

share|improve this answer

You need to install the package which actually includes g++:

$ type g++
g++ is /usr/bin/g++
$ rpm -qf /usr/bin/g++

so, assuming you are connected to the internet, you can do this with yum:

$ sudo yum install gcc-c++

that will automatically install g++ and any other missing dependencies.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.