Ubuntu under GCC, g++ and Gfortran version switching

Source: Internet
Author: User
Tags gfortran

First step: Using which gcc, which g++, and which gfortran to view the location, my display results are:/usr/bin/gcc;/usr/bin/g++ and/usr/bin/gfortran

Part Two: First, take a look at what version of GCC you have installed in your Ubuntu command: ls/usr/bin/gcc*-L;

The gcc/g++ in Ubuntu 12.04 are all 4.6, and we downgrade the system to 4.4 by default.

$sudo Apt-get Install gcc-4.4

$sudo update-alternatives--INSTALL/USR/BIN/GCC gcc/usr/bin/gcc-4.4 40

(Here "40" is the priority, the higher the value the higher the priority)

$sudo update-alternatives--INSTALL/USR/BIN/GCC gcc/usr/bin/gcc-4.6 60

(This machine comes with a setting of 60 higher priority)

Select the system default GCC

$sudo update-alternatives--config gcc

Selection Path Priority Status

------------------------------------------------------------

* 0/usr/bin/gcc-4.6 Auto mode

1/usr/bin/gcc-4.4 Manual Mode

2/usr/bin/gcc-4.6 Manual Mode

The default system with the highest priority,

We're going to choose 1 here.

Next, g++ the same steps

$sudo Apt-get Install g++-4.4

$sudo Apt-get Install G++-4.4-multilib

$sudo update-alternatives--install/usr/bin/g++ g++/usr/bin/g++-4.4 40

$sudo update-alternatives--install/usr/bin/g++ g++/usr/bin/g++-4.6 60

$sudo update-alternatives--config g++

Selection Path Priority Status

------------------------------------------------------------

* 0/usr/bin/g++-4.6 Auto mode

1/usr/bin/g++-4.4 Manual Mode

2/usr/bin/g++-4.6 Manual Mode

Select 1.

If you want to change to a higher version of the ready

Update-alternatives--config command Switch!

Ubuntu under GCC, g++ and Gfortran version switching

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.