1, download the installation package, CD to the directory where the files
sudo dpkg-i gcc41-compat-4.1.2-ubuntu1210_i386.deb g++41-compat-4.1.2_i386.deb
2. View GCC installed to the system
ls/usr/bin/gcc*
3.
After downloading the package, it is recommended to install it directly with sudo dkpg-i *.deb
Because GCC installs with each other version of support, there are very frustrating order requirements, as if the installation system will automatically arrange the order of installation, more convenient
After installation, you need to set up the default GCC and g++ version (PS: The version of the settings here according to the version of the compiler in your system)
sudo update-alternatives--INSTALL/USR/BIN/GCC gcc/usr/bin/gcc-4.4 40
Update-alternatives: Using/usr/bin/gcc-4.1 to provide/USR/BIN/GCC (GCC) in automatic mode
sudo update-alternatives--install/usr/bin/gcc gcc/usr/bin/gcc-4.1 30
Update-alternatives: Using/usr/bin/gcc-4.4 to provide/USR/BIN/GCC (GCC) in automatic mode
Then set the default compiler, as follows:
sudo update-alternatives--config gcc
There are 2 options available for replacing the item gcc (provides/USR/BIN/GCC).
Select Path Priority state
------------------------------------------------------------
* 0/usr/bin/gcc-4.4 40 Auto mode
1/usr/bin/gcc-4.1 30 Manual Mode
2/usr/bin/gcc-4.4 40 Manual Mode
To maintain the current value [*] press ENTER, or type the number of your choice: 1
g++ 's setup page almost changed GCC to g++, as follows
sudo update-alternatives--install/usr/bin/g++ g++/usr/bin/g++-4.4 40
Update-alternatives: Use/usr/bin/g++-4.1 to provide/usr/bin/g++ (g++) in automatic mode
sudo update-alternatives--install/usr/bin/g++ g++/usr/bin/g++-4.1 30
Update-alternatives: Use/usr/bin/g++-4.4 to provide/usr/bin/g++ (g++) in automatic mode
Then set the default compiler, as follows:
sudo update-alternatives--config g++
There are 2 options available for replacing item g++ (providing/usr/bin/g++).
Select Path Priority state
------------------------------------------------------------
* 0/usr/bin/g++-4.4 40 Auto mode
1/usr/bin/g++-4.1 30 Manual Mode
2/usr/bin/g++-4.4 40 Manual Mode
To maintain the current value [*] press ENTER, or type the number of the selection: 1, so the basic setup is OK
"NS2" installs low version GGC under Linux