Install g++ to CentOS 6.2

Every day solutions to every day challenges. + Brilliant stuff

Moderators: b1o, jkerr82508

Forum rules
Please feel free to post your tip it does not have to be advanced. Also ask questions directly related to the tip here. But do not start new threads with questions or ask for help here. That is what the help section is for. forum rules: http://bjoernvold.com/forum/viewtopic.php?f=8&t=568
User avatar
dedanna1029
Sound-Berserk
Posts: 8780
Joined: 14 Mar 2010, 20:29
Contact:

Install g++ to CentOS 6.2

Postby dedanna1029 » 23 Nov 2012, 19:44

It is strange, but there is a certain way one must go about it for CentOS 6.2. If you type in "yum install g++", or "yum install gcc-g++", it won't find it. There is a way, however, where it will find it, and it will install. Reasons remain unknown as to why this is, but I thought I'd pass it along. What you need to do is:

Code: Select all

su
password
yum install gcc-c++ compat-gcc-32 compat-gcc-32-c++

It will NOT find compat-gcc-32 or compat-gcc-32-c++, but it WILL find gcc-c++, which is exactly what you need for g++.

I found it here, while searching for an rpm for g++ (which isn't in the repos).

Code: Select all

.:[ root@dedanna.rocks.net : 11:31:20 : ~ ]:.:) yum install gcc-c++ compat-gcc-32 compat-gcc-32-c++

<snip for unnecessary mirror info>

mirror.spro.net already timed: 1.0922369957
 * mirror.spro.net : 1.092237 secs
 * updates: mirrors.greenmountainaccess.net
C6.2-base                                                                                             | 3.7 kB     00:00     
C6.2-centosplus                                                                                       | 3.5 kB     00:00     
C6.2-contrib                                                                                          |  951 B     00:00     
C6.2-extras                                                                                           | 3.5 kB     00:00     
C6.2-updates                                                                                          | 3.5 kB     00:00     
adobe-linux-i386                                                                                      |  951 B     00:00     
base                                                                                                  | 3.7 kB     00:00 ...
centosplus                                                                                            | 3.5 kB     00:00     
contrib                                                                                               |  951 B     00:00     
extras                                                                                                | 3.5 kB     00:00 ...
linuxtech-release                                                                                     | 1.3 kB     00:00     
updates                                                                                               | 3.5 kB     00:00

<snip unnecessary info>

Dependencies Resolved

=============================================================================================================================
 Package                             Arch                     Version                         Repository                Size
=============================================================================================================================
Installing:
 gcc-c++                             i686                     4.4.6-4.el6                     base                     4.3 M
Installing for dependencies:
 libstdc++-devel                     i686                     4.4.6-4.el6                     base                     1.5 M

And there you go. :) The repos were showed so you would know which ones are needed. Now you will have g++ to install your compiled proggies with. :)
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

Return to “Tips & Tricks”