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 in your Ubuntu: ls/usr/bin/gcc *-l;

Gcc/g ++ in ubuntu 12.04 is 4.6. We will 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. The higher the value, the higher the priority)

$ Sudo update-alternatives -- install/usr/bin/gcc/usr/bin/gcc-4.6 60

(The built-in priority is set to 60 and higher)

Select the default gcc

$ Sudo update-alternatives -- config gcc

Selection Path Priority Status

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

* 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

The highest priority is used by default,

Select 1 here.

Next, perform the same steps in g ++.

$ Sudo apt-get install g ++-4.4

$ Sudo apt-get install g ++-4.4-multilib

 

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

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

$ Sudo update-alternatives -- config g ++

Selection Path Priority Status

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

* 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

Update-alternatives -- config command switch!

Linux GCC 4.8.1 clear and concise tutorial (Ubuntu 12.04 64-bit edition as an example)

Compile and install GCC 4.8.1 + GDB 7.6.1 + Eclipse in CentOS 6.4 and compile and install GCC 4.8.1 + GDB 7.6.1 + Eclipse in CentOS 6.4

Install and use Vim + GCC + GDB in Ubuntu

Switch two GCC versions in Ubuntu

CentOS6.5 upgrade to manually install GCC4.8.2

GCC details: click here
GCC: click here

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.