How to use lower gcc/g ++ versions in Ubuntu 12.04 LTS

Source: Internet
Author: User

There are two solutions:
The first method:
Download the. deb file of the corresponding version and put it in the same directory.
Enter this directory and enter the command
Sudo dpkg-I *
After installing the gcc-4.1, you need to establish a link for the gcc-4.1:
Sudo mv/usr/bin/gcc/usr/bin/gcc_mybackup
Sudo ln-s/usr/bin/gcc-4.1/usr/bin/gcc
(If you need to compile other programs with a gcc-4.6, you can call the gcc-4.6 directly or restore the soft link to the gcc-4.6 using the following command sudo mv/usr/bin/gcc_mybackup/usr/bin/gcc)
Verify that the gcc-4.1 soft link is established successfully
Sudo cd/usr/bin/
$ Sudo ls-la | grep gcc
You can see the following content, indicating that the gcc-4.1 soft link is successfully established
Lrwxrwxrwx 1 root 7 2010-05-09 gcc-> gcc-4.1
 
Method 2:
Edit the/etc/apt/sources. list file and uncomment the lines ending with multiverse and universe. That is, select the multiverse and universe software libraries as the update source.
Sudo apt-get update
Install gcc-4.1 related components using commands
$ Sudo apt-get install gcc-4.1 gcc-4.1-multilib libstdc ++ 6-4.1-dev
Create soft links for gcc-4.1
$ Sudo cd/usr/bin/
$ Sudo ln-s gcc-4.1 gcc
Verify that the gcc-4.1 soft link is established successfully
$ Sudo ls-la | grep gcc
You can see the following content, indicating that the gcc-4.1 soft link is successfully established
Lrwxrwxrwx 1 root 7 2010-05-09 gcc-> gcc-4.1
Author: lqhbupt

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.