留言与评论(共有 0 条评论) |
发布时间:2020-04-12 08:55:56
下载源码包,编译安装:
./configure --prefix=/usr
make
make install (要有权限)
或者,
在gentoo下:emerge gcc
在debian或其衍生版下:apt-get install gcc
在windows下:下载gcc的二进制包,并安装
在CentOS 7和RHEL 7系统上如何安装Gnu GCC编译器和相关的工具比如:autoconf,automake,flex, c++编译器等工具。我们可以通过在centos 或者rhel 7 系统上安装下面的软件包来搭建基本的开发环境。 autoconf automake binutils bison flex gcc gcc-c++ gettext libtool make patch pkgconfig redhat-rpm-config rpm-build rpm-sign 显示当前系统的yum group,使用下面的命令: yum group list 命令输出: [root@itsprite /]# yum group list Loaded plugins: fastestmirror, langpacks There is no installed groups file. Maybe run: yum groups mark convert (see man yum) Loading mirror speeds from cached hostfile * base: mirrors.btte.net * extras: mirrors.btte.net * updates: mirrors.btte.net Available environment groups: Minimal Install Infrastructure Server File and Print Server Basic Web Server Virtualization Host Server with GUI GNOME Desktop KDE Plasma Workspaces Development and Creative Workstation Available Groups: Compatibility Libraries Console Internet Tools Development Tools Graphical Administration Tools Legacy UNIX Compatibility Scientific Support Security Tools Smart Card Support System Administration Tools System Management Done 安装GCC和开发环境 输入下面的命令: yum group install "Development Tools" 安装完之后,使用下面的命令来验证gcc是否安装成功: whereis gcc 命令输出: [root@itsprite /]# whereis gcc gcc:/usr/bin/gcc /usr/lib/gcc /usr/libexec/gcc /usr/share/man/man1/gcc.1.gz 输入下面的命令来查看gcc工具的版本: [root@itsprite /]# gcc --version gcc (GCC) 4.8.2 20140120(Red Hat 4.8.2-16) 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. 测试GCC编译器 下面我们使用刚安装好的GCC编译器来编译一个c语言程序. 创建下面的test.c程序: #include int main(void){ printf("Hello World!n"); return0; } 输入命令编译test.c 文件: gcc test.c -o test 执行编译后的文件: ./test Hello World!
留言与评论(共有 0 条评论) |
全站搜索