gnu gcc编译器安装
The GNU Compiler Collection
or GCC
is a compiler and related auxiliary tools which are used to compile different programming languages into binary and related formats. GCC has been created and currently developed by the GNU Project. Also, the GCC name comes from the GNU as you have noticed. GCC is very popular in the opensource community and used by different projects like the Linux Kernel. GCC has played a very important role in the first two decades of the opensource movement by providing free, open-source, and dynamic compiler collection. GCC is provided with the GPL
or General Public License
where it permits the GCC to distributed in a free and opensource manner.
GNU Compiler Collection
或GCC
是一个编译器和相关的辅助工具,用于将不同的编程语言编译成二进制和相关格式。 GCC已由GNU项目创建和开发。 同样,您已经注意到,GCC名称来自GNU。 GCC在开源社区中非常流行,并被Linux Kernel等不同项目使用。 通过提供免费,开源和动态编译器集合,GCC在开源运动的前二十年中发挥了非常重要的作用。 GCC随GPL
或General Public License
,它允许GCC以自由和开源的方式分发。
海湾合作委员会的历史 (GCC History)
GCC has been started by the GNU Project where Richard Stallman is its pioneer. GCC is first released in March 1987 from the MIT FTP servers. It is named as the first open-source and free software which is popularly used. First C Programming language was supported by in a year C++ programming language supported is added. Also later Objective-C, Objective-C++, Fortran, Java, Ada, and Go supported have been added. As writing this post the latest GCC version is 10.2 which has released July 2020.
GCC由GNU项目发起,Richard Stallman是其先驱。 GCC于1987年3月首次从MIT FTP服务器发布。 它被称为第一个被广泛使用的开源和免费软件。 添加了第一年受支持的C编程语言。 稍后还添加了对Objective-C,Objective-C ++,Fortran,Java,Ada和Go的支持。 在撰写本文时,最新的GCC版本是2020年7月发布的10.2。
GCC支持的编程语言 (GCC Supported Programming Languages)
GCC is open source and flexible compiler collection where it supports a wide range of programming languages like below.
GCC是开放源代码和灵活的编译器集合,在其中支持多种编程语言,如下所示。
- C Programming Language C语言
- C++ Programming LanguageC ++程式语言
- Objective-C Programming LanguageObjective-C编程语言
- Objective-C++ Programming LanguageObjective-C ++编程语言
- Fortran Programming LanguageFortran编程语言
- Ada Programming LanguageAda编程语言
- Go Programming Language去编程语言
- Java Programming languageJava编程语言
GCC支持的硬件平台和体系结构(GCC Supported Hardware Platforms and Architectures)
Like programming languages, GCC supported different hardware platforms and architectures like below.
与编程语言一样,GCC支持以下不同的硬件平台和体系结构。
- Alpha Α
- ARM 臂
- IA-32IA-32
- IA-64 IA-64
- MIPS MIPS
- PowerPC PowerPC
- SPARC SPARC
- x86-64 x86-64
- … …
GCC用法 (GCC Usage)
GCC can be installed into different operating systems like Linux, Ubuntu, Fedora, CentOS, Debian, Mint, Kali, Windows, MacOS, etc. But the Linux platforms are the most comfortable platforms where GCC is mainly developed on Linux. GCC can be installed by using installers or package managers for the supported operating systems. GCC provides command-line usage where different options are provided in order to specify the compiling process details. Below you can find some basic usage examples about the GCC.
GCC可以安装到Linux,Ubuntu,Fedora,CentOS,Debian,Mint,Kali,Windows,MacOS等不同的操作系统中。但是Linux平台是最舒适的平台,其中GCC主要在Linux上开发。 可以使用受支持的操作系统的安装程序或程序包管理器来安装GCC。 GCC提供了命令行用法,其中提供了不同的选项以指定编译过程的详细信息。 您可以在下面找到有关GCC的一些基本用法示例。
# Simply compile with GCC
$ gcc helloworld.c
# Compile into an executable file named hw
$ gcc helloworld.c -o hw
# Compile multiple files
$ gcc helloworld1.c myfile.c
# Show warning messages
$ gcc -Wall helloworld.c -o hw
热门的GCC编译器选项 (Popular GCC Compiler Options)
GCC is a features rich compiler toolset where different options are provided for different cases. GCC options are used to change the default compile attributes. For example extra input to the source code before compile can be provided with the macros etc. Below we will list some of the popular GCC compiler options below.
GCC是功能丰富的编译器工具集,其中针对不同情况提供了不同的选项。 GCC选项用于更改默认的编译属性。 例如,宏等可以提供编译前对源代码的额外输入。下面,我们将在下面列出一些流行的GCC编译器选项。
-c
option compiles source files into object files without linking.
-c
选项将源文件编译为目标文件而无需链接。
-Dname=value
defines and provides preprocessor macro to the compilation process.
-Dname=value
定义编译器宏并将其提供给编译过程。
-fPIC
generates position independent code for shared libraries to be used by other binaries.
-fPIC
为共享库生成位置无关的代码,以供其他二进制文件使用。
-glevel
generates debug information into binary which can be debugged for errors with gdb tool.
-glevel
调试信息生成为二进制文件,可以使用gdb工具对错误信息进行调试。
-llib
links given lib or library into the created binaries.
-llib
将给定的lib或库链接到创建的二进制文件中。
Ldir
look in given dir for library files to be used in compile process.
Ldir
在给定的dir中查找要在编译过程中使用的库文件。
-o myexe
sets the created executable file as myexe.
-o myexe
将创建的可执行文件设置为myexe。
-Olevel
optimize the code and creates optimized executables and binaries.
-Olevel
优化代码并创建优化的可执行文件和二进制文件。
-shared
generates shared object file for shared library.
-shared
为共享库生成共享对象文件。
-w
disables all warning messages.
-w
禁用所有警告消息。
-Wall
enables all warning messages.
-Wall
启用所有警告消息。
-Wextra
enables extra warning messages in a more verbose manner.
-Wextra
以更详细的方式启用额外的警告消息。
翻译自: https://www.poftut.com/what-is-gcc-gnu-compiler-collection/
gnu gcc编译器安装