tags:

views:

74

answers:

2
$ yum list | grep gcc
arm-gp2x-linux-gcc.i686            4.1.2-11.fc12          @fedora               
arm-gp2x-linux-gcc-c++.i686        4.1.2-11.fc12          @fedora               
gcc.i686                           4.4.3-4.fc12           @updates              
libgcc.i686                        4.4.3-4.fc12           @updates              
avr-gcc.i686                       4.4.2-2.fc12           updates               
avr-gcc-c++.i686                   4.4.2-2.fc12           updates               
compat-gcc-34.i686                 3.4.6-18               fedora                
compat-gcc-34-c++.i686             3.4.6-18               fedora                
compat-gcc-34-g77.i686             3.4.6-18               fedora                
compat-libgcc-296.i686             2.96-143               fedora                
gcc-c++.i686                       4.4.3-4.fc12           updates               
gcc-gfortran.i686                  4.4.3-4.fc12           updates               
gcc-gnat.i686                      4.4.3-4.fc12           updates               
gcc-java.i686                      4.4.3-4.fc12           updates               
gcc-objc.i686                      4.4.3-4.fc12           updates               
gcc-objc++.i686                    4.4.3-4.fc12           updates               
mingw32-gcc.i686                   4.4.1-3.fc12           fedora                
mingw32-gcc-c++.i686               4.4.1-3.fc12           fedora                
mingw32-gcc-gfortran.i686          4.4.1-3.fc12           fedora                
mingw32-gcc-objc.i686              4.4.1-3.fc12           fedora                
mingw32-gcc-objc++.i686            4.4.1-3.fc12           fedora                
msp430-gcc.i686                    3.2.3-3.20090210cvs.fc12
$

gcc works fine on .c files but fails on .cpp files saying:

$ gcc: error trying to exec 'cc1plus': execvp: No such file or directory

g++ fails saying:

$ g++: Command not found.

What should I do to be able to compile C++ files?

+3  A: 

you need to install the gcc-c++ package:

yum install gcc-c++

Gregory Pakosz
What's this line then? `gcc-c++.i686 4.4.3-4.fc12 updates`
Nitrodist
@Nitrodist: `yum list` doesn't list the installed packages, it lists all available packages. The package `gcc-c++` is presumably available through some sort of update repository.
Troubadour
+3  A: 

gcc-c++ is not installed.

The yum list command shows all packages, not just the installed packages. The packages that are installed are prefixed with an ampersand or "@" sign. The packages that are not installed (but are available to be installed) lack the ampersand.

To see what is installed try the command rpm -qa. Or in your example rpm -qa | grep gcc

Oddly enough, if you didn't just grep for gcc, you would have been able to see the "Installed packages" and "Available packages" output lines between the two sets.

Edwin Buck