9

In my Ubuntu there is g++ --version -

g++ (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I want to have same g++ --version on another Linux machine which has -

g++ (GCC) 4.1.2 20070626 (Red Hat 4.1.2-14)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

How can I alter my g++ version to be the same as the above?

Peachy
  • 7,235
  • 10
  • 40
  • 47
URL87
  • 215

2 Answers2

5

Download the g++-4.1 version from here. g++-4.1 is not available in the recent Ubuntu repositories. So you need to download the package from the link provided.

Install/compile the download package alongside with the current version of g++.

Then use update-alternatives to switch version

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.3 10

Change the default version by choosing the appropriate version:

sudo update-alternatives --config g++
devav2
  • 37,290
0

Personally I wouldn't revert to an earlier version of g++ unless there was no other possible way to achieve my desired results. g++ is available for all supported versions of Ubuntu in the repository and can be installed with sudo apt install g++ If you do indeed need multiple versions you'll want to utilize How to choose the default gcc and g++ version? as @boomkin indicated in this comment.

Elder Geek
  • 36,752