How to install GCC on CentOS 8

The GNU Compiler Collection is a collection of compilers and libraries for language development, including: C, C++, Objective-C, Fortran, Ada, Go, and D programming languages. Many open source projects, including Linux kernel and GNU tools, are compiled using GCC.

This article describes how to install GCC on CentOS 8.

1. Install GCC on CentOS

The default CentOS software source contains a package group named "Development Tools", which contains the GNU editor collection, GNU debugger, and other development libraries and tools necessary for compiling software.

To install the development tool package, run the following command as a user with sudo privileges or as root:

sudo dnf group install "Development Tools"

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

You may also want to install a manual on how to use GNU/Linux development.

sudo dnf install man-pages

Use the gcc --version command to print the GCC version to verify whether the GCC compiler is successfully installed:

gcc --version

The default available version number of GCC in the CentOS 8 software source is 8.3.1:

gcc(GCC)8.3.120190507(Red Hat 8.3.1-4)Copyright(C)2018 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.

that's it. GCC has been installed on your CentOS system, and you can start using it.

Two, compile a Hello World example##

In this chapter, we will use GCC to compile a basic C program. Open your text editor and create the following file:

nano hello.c
# include <stdio.h>
int main(){printf("Hello World!\n");return0;}

Save the file, and compile it into an executable file, run:

gcc hello.c -o hello

When you run this command, a binary file named hello will be created in the same directory.

Execute this hello program:

. /hello

This program will output:

Hello World!

Three, summary##

We have shown how to install GCC on CentOS 8. You can now browse the official GCC documentation page and learn how to use GCC and G++ to compile your C and C++ programs.

Recommended Posts

How to install GCC on CentOS 8
How to install GCC compiler on CentOS 7
How to install jdk1.8 on centOS7
How to install MySQL on CentOS 8
How to install Memcached on CentOS 8
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install TensorFlow on CentOS 8
How to install TeamViewer on CentOS 8
How to install Perl 5 on CentOS
How to install Git on CentOS 8
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Java on CentOS 8
How to install Go on CentOS 8
How to install Yarn on CentOS 8
How to install Nginx on CentOS 8
How to install Asterisk on CentOS 7
How to install Jenkins on CentOS 8
How to install Vagrant on CentOS 8
How to install Python 3.8 on CentOS 8
How to install Tomcat 9 on CentOS 8
How to install Webmin on CentOS 8
How to install Ruby on CentOS 8
How to install Skype on CentOS 8
How to install htop on CentOS 8
How to install Python on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Postgresql on CentOS 8
How to install Wordpress on Centos
How to install htop on CentOS 8
How to install TeamViewer on CentOS 8
How to install MariaDB on CentOS 8
How to install MongoDB on CentOS 7
How to install Odoo 13 on CentOS 8
How to install Apache on CentOS 8
How to install OpenCV on CentOS 8
How to install PHP on CentOS 8
How to install MongoDB on CentOS 8
How to install Apache Maven on CentOS 8
How to install Apache Kafka on CentOS 7
[Graphic] How to install tomcat on centos
R&amp;D: How To Install Python 3 on CentOS 7
How to install offline JDK1.8 on centos7.0
How to install GCC compiler on Ubuntu 18.04
How to install and configure Elasticsearch on CentOS 7
How to install Visual Studio Code on CentOS 8
How to install RPM packages on CentOS Linux
How to install and configure VNC on CentOS 8
How to install and use Composer on CentOS 8
How to install and configure Redis on CentOS 8
How to install Node.js and npm on CentOS 8
How to install jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511
How to install and configure phpMyAdmin on CentOS 6
How to install and use Curl on CentOS 8
How to install and configure Owncloud on CentOS 8
How to install VirtualBox client extension on CentOS 8
How to install Docker CE on RHEL 8 / CentOS 8
How to install and uninstall tomcat on centos