How to install GCC development tools on CentOS 8 (Development Tools)

GNU Compiler Collection (GCC) is a set of C, C ++, Objective-C, Fortran, Ada, Go and the D programming language compiler and libraries. Many open source projects, including Linux kernel and the GNU tools, are compiled with GCC.

GCC installed on CentOS

The default CentOS repositories contain packages group called "Development Tools", including the GNU compiler collection, other development libraries and tools needed for GNU compiler and debugger software.

To install the Developer Tools, run as root or a user with sudo privileges the following command:

How to install GCC development tools on CentOS 8 (Development Tools)

This command will install a number of packages, including gcc, g ++ and make.

You may also need to install the man pages about using GNU / Linux for development:

By using the display GCC version of gcc --version command to verify the successful installation of the GCC compiler:

The default version of CentOS 8 GCC repository available is 8.3.1:

Output is as follows:

How to install GCC development tools on CentOS 8 (Development Tools)

Ok, that's it. GCC already installed on CentOS system, you can start using it.

Compile Hello World example

In this section, we will use the GCC compiler basic C program. Open your text editor and create the following files:

How to install GCC development tools on CentOS 8 (Development Tools)

Save the file, and by running the following command to compile it into an executable file:

It will create a binary file called hello in the same directory as the command is run.

Hello program execution:

The program will output:

How to install GCC development tools on CentOS 8 (Development Tools)

to sum up

We've shown you how to install GCC on CentOS 8. You can now access the GCC official document page to learn how to use the GCC and G ++ to compile C and C ++ programs.

If you encounter problems or have feedback, please leave a comment below.

Guess you like

Origin www.linuxidc.com/Linux/2020-03/162624.htm