Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install GCC on CentOS

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to install GCC on CentOS". In daily operation, I believe many people have doubts about how to install GCC on CentOS. Xiaobian consulted various materials and sorted out simple and easy operation methods. I hope to help you answer the doubts about "how to install GCC on CentOS"! Next, please follow the small series to learn together!

GCC, commonly referred to as GUN Compiler Collection, contains other tools in addition to compilers, so it can build source code written in human-friendly high-level languages into binary code that computers can execute directly. GCC is the most commonly used compiler for Linux platform, and it is the de facto standard for Linux platform compilers. GCC is also one of the most popular compilers in Linux embedded development.

Install GCC on CentOS

The default CentOS software source contains a package group called "Development Tools," which contains the GNU editor collection, GNU debuggers, and other development libraries and tools necessary to compile software.

To install the development tool package, run the following command as sudo or root:

sudo dnf group install "Development Tools"

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

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

sudo dnf install man-pages

Verify that the GCC compiler was successfully installed by printing the GCC version using the gcc --version command:

gcc --version

The default version number available for GCC in CentOS 8 software sources is 8.3.1:

gcc (GCC) 8.3.1 20190507 (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 NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

That's all. GCC is installed on your CentOS system and you can start using it.

Compiling a Hello World instance

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

nano hello.c#include int main(){ printf ("Hello World!\ n"); return 0;}

Save the file, compile it into an executable file, and 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! At this point, the study of "how to install GCC on CentOS" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report