How do I install g++ 4.5 on ubuntu 10.10?

NoOp glgxg at sbcglobal.net
Fri Nov 19 03:00:01 UTC 2010


On 11/18/2010 05:59 PM, K. Frank wrote:
> Hello NoOp -
...
>> My apologies for my previous post... Try this:
>>
>> $ sudo apt-get install g++-4.5
>>
>> that should yield something along the lines of:
>>
>> Reading package lists... Done
>> ...
>> I _think_ that is what you are looking for. If so, you may also want to
>> go back later and install the suggested packages. Or:
> 
> That (mostly) did the trick.
> 
> My first question:
> 
> What is the difference between:
> 
>    sudo apt-get install g++-4.5  (which seems to work)
> 
> and
> 
>    sudo apt-get install g++  (which installed 4.4)

To be honest, I don't actually know. I _think that g++ (4.4) is the
default. g++-4.5 is the dev version as best I can tell.

> 
> It never occurred to me to specify g++-4.5.  Is there some
> sort of hierarchical naming convention going on?
> 
> Second question:
> 
> How can I get g++ to resolve to version 4.5?

Don't know that either. In the interim you can:

$ g++-4.5 <filename>

and that will work if you specify a file. I'm pretty sure that someone
with better cli knowledge will come along shortly and advise how to set
a link/dpkg --config et al to have g++ default to g++-4.5. Perhaps you
can do it in the same manner as you set your java etc., to a particular
version. But I really do now know the answer - sorry. I only looked into
how to install due to your OP.

...
> Third question:
> 
> Not that I care, but suppose I had wanted to install
> 4.5.1-10ubuntu1 (as I tried to do with dpkg)?  Why
> did "apt-get install g++-4.5" resolve to 4.5.1-7?  Is
> 4.5.1-10 not compatible with ubuntu 10.10?

When you install a .deb file directly it will not pull in the
dependencies. dpkg is a simple package installer. IOW; if you:

$ sudo dpkg -i <somepackage>

dpkg won't go out and get the package & dependencies, it will only do
exactly as you instructed it to do: install the .deb. See:

$ man dpkg
and
$ man apt-get

to see the differences.
...





More information about the ubuntu-users mailing list