環境
VM:VMware Player 5.0
OS:CentOS(6.5 2.6.32-431.el6.i686)
GCC:4.4.7 --> 4.8.2
GCC來源:載點
安裝步驟
# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# yum install -y gcc-c++
# mkdir -p /data/src
# cd /data/src
# curl -R -O ftp://gnu.mirror.iweb.com/gcc/gcc-4.8.2/gcc-4.8.2.tar.gz
# tar zxf gcc-4.8.2.tar.gz
# cd gcc-4.8.2
# ./contrib/download_prerequisites //安裝gmp、mpfr、mpc
# cd ..
# mkdir build_gcc482
# cd build_gcc482
# ../gcc-4.8.2/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
# make
# make install
# gcc --version
gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
測試
# vim helloworld.c
#include
int main(void){
printf("hello world. \n");
return 0;
}
# gcc helloworld.c
# ls
a.out helloworld.c
# ./a.out
hello world.
沒有留言:
張貼留言