
The newer versions of the GCC compiler include support for new languages, better performance, extended features. In this section, we will provide instructions about how to install and use multiple versions of GCC on CentOS 7. This will create a binary file named hello in the same directory where you run the command.

Save the file and compile it into an executable by running the following command: gcc hello.c -o hello

Open your text editorĪnd create the following file: nano hello.c Compiling a Hello World Example #Ĭompiling a basic C or C++ program using GCC is an easy task. GCC is now installed on your system, and you can start using it. Warranty not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This is free software see the source for copying conditions. The default version of GCC available in the CentOS 7 repositories is 4.8.5: gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)Ĭopyright (C) 2015 Free Software Foundation, Inc. Validate that the GCC compiler is successfully installed by using the gcc -version command which prints the GCC version: gcc -version You may also want to install the manual pages about using GNU/Linux for development: sudo yum install man-pages The command installs a bunch of new packages including gcc, g++ and make.

To install the Development Tools including the GCC Compiler, run: sudo yum group install "Development Tools" The default CentOS repositories contain a package group named Development Tools that contains the GCC compiler and a lot of libraries and other utilities required for compiling software. To add new repositories and install packages on your CentOS system, you must be logged in as root or user with sudo privileges We’ll explain how to install the distro stable version and the newer version of GCC available from the SCL repository. This tutorial explains how to install the GCC compiler on CentOS 7. Many open-source projects including the GNU tools and the Linux kernel are compiled with GCC. The GNU Compiler Collection (GCC) is a collection of compilers and libraries for C, C++, Objective-C, Fortran, Ada, Go
