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