Switch gcc, g ++, and gfortran versions in ubuntu

Source: Internet
Author: User
Tags gfortran

Switch gcc, g ++, and gfortran versions in ubuntu
Step 1: use which gcc, which g ++, and which gfortran to view the location. My result is/usr/bin/gcc; /usr/bin/g ++ and/usr/bin/gfortran Part 2: first, let's take a look at the gcc commands installed on Ubuntu: ls/usr/bin/gcc *-l; gcc/g ++ in ubuntu 12.04 is 4.6, we downgrade the default system to 4.4 $ sudo apt-get install gcc-4.4 $ sudo update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-4.4 40 (here "40 "is the priority, higher value priority) $ sudo update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-4.6 60 (comes To 60 higher priority) select the default gcc $ sudo update-alternatives -- config gcc Selection Path Priority Status failed * 0/usr/bin/gcc-4.6 60 auto mode 1/usr/bin/gcc-4.4 40 manual mode 2 /usr/bin/gcc-4.6 60 manual mode default system with the highest priority, here we can select 1. Next, g ++ perform the same procedure $ sudo apt-get install g ++-4.4 $ sudo apt-get install g ++-4.4-multilib $ sudo update-alternatives -- inst All/usr/bin/g ++-4.4 40 $ sudo update-alternatives -- install/usr/bin/g ++ +/usr/bin/g ++-4.6 60 $ sudo update-alternatives -- config g ++ Selection Path Priority Status limit * 0/usr/bin/g ++-4.6 60 auto mode 1/usr/bin/g ++-4.4 40 manual mode 2/usr/bin/g ++-4.6 60 manual mode select 1. if you want to change to a later version, use the update-alternatives-config command to switch!

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.