Install gcc4.1 and g ++ 4.1 In Ubuntu10.04

Source: Internet
Author: User
In Ubuntu10.04, the default GCC version is GCC4.4.1. Most of the time, we need to use GCC4.1.2. Therefore, we need to install the earlier version of GCC4.1.2. However, I tried to install GCC with version 4.1 and the final version is 4.1.3. It seems that it can be used as well. If you have better ideas, please follow the steps below: first install GCC4.1sudoapt-get Through apt-get

In Ubuntu 10.04, the default GCC version is GCC 4.4.1. Most of the time, we need to use GCC4.1.2, so we need to install the earlier version of GCC 4.1.2. However, I tried to install GCC with version 4.1 and the final version is 4.1.3. It seems that it can be used as well. If you have better ideas, please follow the steps below:

First install GCC4.1 through apt-get

  1. Sudo apt-get install gcc-4.1

After installation, there are two GCC versions 4.4 and 4.1 In the system. You can run the ls command to view them:

  1. Ls/usr/bin/gcc *
  2. /Usr/bin/gcc-4.1/Usr/bin/gcc-4.4/Usr/bin/gccbug-4.1

However, the default GCC version is 4.4. You can use gcc-v to view the version number.

Set the options of GCC4.1 and GCC4.4. Enter the following command on the terminal:

  1. Sudo update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-4.4 40
  2. Sudo update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-4.1 30

Set the default GCC version. Run the following command:

Sudo update-alternatives -- config gcc

Result:

There are 2 choices for the alternative gcc (providing/usr/bin/gcc ).

Selection Path Priority Status
------------------------------------------------------------
* 0/usr/bin/gcc-4.4 40 auto mode
1/usr/bin/gcc-4.1 30 manual mode
2/usr/bin/gcc-4.4 40 manual mode

Enter "1" and check that the gcc version has changed to 4.1 ~~~~

You can also use the same method to switch from a later version of 4.4 to a later version of 4.1...

Of course you also need to switch i486-linux-gnu-gcc and i486-linux-gnu-g ++ to 4.1

The entire switchover script is as follows:

  1. #! /Bin/sh
  2. Update-alternatives -- install/usr/bin/gcc-4.4 40
  3. Update-alternatives -- install/usr/bin/gcc-4.1 30
  4. Update-alternatives -- config gcc
  5. Update-alternatives -- install/usr/bin/g ++-4.4 40
  6. Update-alternatives -- install/usr/bin/g ++-4.1 30
  7. Update-alternatives -- config g ++
  8. Update-alternatives -- install/usr/bin/i486-linux-gnu-gcc i486-linux-gnu-gcc/usr/bin/i486-linux-gnu-gcc-4.4 40
  9. Update-alternatives -- install/usr/bin/i486-linux-gnu-gcc i486-linux-gnu-gcc/usr/bin/i486-linux-gnu-gcc-4.1 30
  10. Update-alternatives -- config i486-linux-gnu-gcc
  11. Update-alternatives -- install/usr/bin/i486-linux-gnu-g + + i486-linux-gnu-g + +/usr/bin/i486-linux-gnu-g + +-4.4 40
  12. Update-alternatives -- install/usr/bin/i486-linux-gnu-g + + i486-linux-gnu-g + +/usr/bin/i486-linux-gnu-g + +-4.1 30
  13. Update-alternatives -- config i486-linux-gnu-g ++
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.