1.) 下载
从网上下载以下软件包,并放到/opt/freeware/src/packages/SOURCES下:
[db2b /opt/freeware/src/packages/SOURCES]$ ls
gcc-4.2.0-3.aix6.1.ppc.rpm libstdcplusplus-4.2.0-3.aix6.1.ppc.rpm
gcc-cplusplus-4.2.0-3.aix6.1.ppc.rpm libstdcplusplus-devel-4.2.0-3.aix6.1.ppc.rpm
libgcc-4.2.0-3.aix6.1.ppc.rpm
2.) 安装
[db2b /opt/freeware/src/packages/SOURCES]$ rpm -ivh gcc-4.2.0-3.aix6.1.ppc.rpm
gcc ##################################################
[db2b /opt/freeware/src/packages/SOURCES]$ rpm -ivh libgcc-4.2.0-3.aix6.1.ppc.rpm
libgcc ##################################################
[db2b /opt/freeware/src/packages/SOURCES]$ rpm -ivh libstdcplusplus-4.2.0-3.aix6.1.ppc.rpm
libstdc++ ##################################################
[db2b /opt/freeware/src/packages/SOURCES]$ rpm -ivh libstdcplusplus-devel-4.2.0-3.aix6.1.ppc.rpm
libstdc++-devel ##################################################
[db2b /opt/freeware/src/packages/SOURCES]$ rpm -ivh gcc-cplusplus-4.2.0-3.aix6.1.ppc.rpm
gcc-c++ ##################################################
[db2b /opt/freeware/src/packages/SOURCES]$ gcc -v
Using built-in specs.
Target: powerpc-ibm-aix6.1.0.0
Configured with: ../configure --with-as=/usr/bin/as --with-ld=/usr/bin/ld --enable-languages=c,c++,java --prefix=/opt/freeware --enable-threads --enable-version-specific-runtime-libs --host=powerpc-ibm-aix6.1.0.0 --target=powerpc-ibm-aix6.1.0.0 --build=powerpc-ibm-aix6.1.0.0 --disable-libjava-multilib
Thread model: aix
gcc version 4.2.0
3.) 测试
切换到非root用户下
[db2b /home/db2users/e97q9a]$ cat hello.c
#include <stdio.h>
int main()
{
printf("hello,world\n");
return 0;
}
[db2b /home/db2users/e97q9a]$ gcc hello.c
[db2b /home/db2users/e97q9a]$ ./a.out
hello,world
原链接:
http://blog.csdn.net/xyz846/article/details/24478685