Install the latest gcc4.2.2-Linux general technology-Linux programming and kernel information under Linux. For more information, see below. Very simple. First of all, the latest package GCC 4.2.bz2 is usually available everywhere. The download speed in linux is very full, more than 20 k, which is disgusting. I like the download speed of thunder, download in windows, about 42 M, download speed 2 to 4 M, return to linux, mount, ntfs format me, not to mention it, say install!
Go to the mounted directory, cp GCC4.2.bz2/azuo first,
Cd/azuo,
Tar-xvf GCC 4.2.bz2,
Get gcc-4.2,
Cd gcc-4.2, creating a folder under the/usr directory is now the directory to store the new gcc,
Mkdir/usr/gcc4
./Configure? Prefix =/usr/gcc4
Press enter and there will be configuration information, as long as no error is reported,
Make, this process has been a long time, because I have not set some specific options, so almost all components need to be compiled once, my computer cpu: AMD 3200 + X2, GB memory, it takes about one and a half hours.
By this time, nothing has been found in/usr/gcc4, and the compilation process occurs in the source folder. Let's take another action, all the things to be used will be configured under the target folder,
Make install;
This process is not short. Just wait.
After everything is done, you can use the latest gcc. You can see that gcc, g ++, and other things in/usr/gcc4/bin are available, write two programs:
Aa. c:
1 # include
2
3 int main (void ){
4 printf ("ad ");
5 return 1;
6}
Gcc-o aa. c
Run./aa
The above is c, and the following is c ++:
A. cpp:
1 # include
2 using namespace std;
3 int main (void ){
4 cout <"OK! "<Endl;
5 return 1;
6}
G ++-o a. cpp
Run it./
If everything is okay, you can replace the original gcc tool with the latest one.
Let's take a look at the original gcc version, so we can uninstall it:
[Root @ BTazuo bin] # rpm-qa gcc
Gcc-4.1.2-27.fc7
[Root @ BTazuo bin] # rpm-e gcc-4.1.2-27.fc7
Error: Failed dependencies:
Gcc is needed by (installed) systemtap-0.5.13-1.fc7.i386
Gcc = 4.1.2-27. fc7 is needed by (installed) gcc-c ++-4.1.2-27. fc7.i386
Gcc = 4.1.2-27. fc7 is needed by (installed) gcc-gfortran-4.1.2-27. fc7. i386
So far, both gcc and g ++ have been established and can be used. Finally, the original package and decompression files can be deleted to save hard disk space!
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.