Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

not able to use g++ from Fedora

Tags:

c++

unix

gcc

g++

glibc

$ 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?

like image 934
Lazer Avatar asked May 13 '10 20:05

Lazer


2 Answers

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

yum install gcc-c++

like image 67
Gregory Pakosz Avatar answered Oct 21 '22 18:10

Gregory Pakosz


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.

like image 9
Edwin Buck Avatar answered Oct 21 '22 18:10

Edwin Buck