Two methods for changing the gcc version of debian7

Source: Internet
Author: User
Recently in the compilation of qt, before using debian6, gcc version is gcc-4.4, when using debian7, the compilation encountered a lot of different problems with debian6, debian7 default gcc uses gcc-4.7, this may be a problem with the compiler version. Therefore, you need to change the gcc version of debian 7 to debian.

Method 1:

Install gcc4.4 and g ++ 4.4

Copy codeThe code is as follows:
Sudo apt-get install gcc-4.4
Sudo apt-get isntall g ++-4.4

 
Modify the default gcc and g ++ version to 4.4.

Copy codeThe code is as follows:
Sudo update-alternatives -- remove-all gcc

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

 
Configure the default gcc and g ++


Copy codeThe code is as follows:
Sudo update-alternatives -- config gcc
Sudo update-alternatives -- config g ++

 
Method 2:
 
First, let's take a look at the gcc commands installed in your Debian: ls/usr/bin/gcc *-l my display is


Copy codeThe code is as follows:
Lrwxrwxrwx 1 root 7/usr/bin/gcc-> gcc-4.7

-Rwxr-xr-x 1 root 224544 2011-10-06/usr/bin/gcc-4.4

-Rwxr-xr-x 1 root 237072/usr/bin/gcc-4.5

-Rwxr-xr-x 1 root 302104/usr/bin/gcc-4.6

From the above display we can see that the default installation is gcc-4.7, now to change to gcc-4.4

Delete the soft connection file/usr/bin/gcc for the gcc-4.7. (Just delete the soft connection)

Command: sudo rm/usr/bin/gcc

Then a soft connection points to the gcc-4.4.

Command: sudo ln-s/usr/bin/gcc-4.4/usr/bin/gcc

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.