JIYIK CN >

Current Location:Home > Learning > OPERATING SYSTEM >

How to Install GCC Compiler on Ubuntu 18.04

Author:JIYIK Last Updated:2025/04/06 Views:

GCCIt is the abbreviation of GNU Compiler Collection, which is applicable to different programming languages ​​such as R, C, C++, Objective-C, Fortran, Ada, Go, D, etc. We can aptinstall the compiler on Ubuntu using the command line tool GCC. We must be logged in as a super user to use aptinstallation GCC.

UbuntuInstall onGCC

In the default Ubunturepository, there is a build-essentialmetapackage called that contains GCCand various other compilers, such as g++and make.

We can also build-essentialsinstall it by installing the package GCC. Once we install build-essentialthe package, GCCit is also installed in our system.

To install build-essential, we follow the steps below.

Verify GCCthe installation of

We use the following command to verify GCCwhether the installation is successful.

gcc --version

If GCCis installed successfully, we will get an output including the version and other GCCinformation about .

Output:

gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 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.

GCCCompile the program using

To compile the program using GCC, we use the following command.

gcc <filename> -o <name_of_executable>

It compiles the program <filename>to produce an <name_of_executable>executable file called . When we run this executable file, we get the output.

gcc hello_world.c -o hello_world

It compiles the program hello_world.c, producing an hello_worldexecutable file called .

To run this executable, we use the command.

./hello_world

Installing multiple GCCversions

We can also install multiple versions in the system GCC.

To install multiple versions of Ubuntu, we follow the steps given below.

For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.

Article URL:

Related Articles

Switching PHP versions on Ubuntu

Publish Date:2025/04/13 Views:78 Category:PHP

Different tasks may require running multiple versions of PHP. You may need to switch PHP versions by running two sites on the same server or testing older versions of code using outdated methods. We can switch PHP versions on Ubuntu using t

Restart PostgreSQL in Ubuntu 18.04

Publish Date:2025/04/09 Views:72 Category:PostgreSQL

This short article shows how to restart PostgreSQL in Ubuntu. Restart PostgreSQL Server in Ubuntu You can restart Postgres server in Ubuntu using the following command. Order: sudo service postgres restart Sometimes the above command does n

How to Install Nginx on Ubuntu 20.04?

Publish Date:2025/04/07 Views:157 Category:OPERATING SYSTEM

Nginx is one of the most popular web servers in the world, responsible for hosting some of the largest and most trafficked sites on the Internet. It is a lightweight application software that can be used as a web server or a reverse proxy.

How to Update Ubuntu Scrolling Speed

Publish Date:2025/04/07 Views:77 Category:OPERATING SYSTEM

It's strange that there's no default GUI provided for us to update the scroll speed on Ubuntu, this is one of the more obvious configuration options missing. We will use imwheel to adjust the scroll speed of different applications. First cr

Install WordPress with Nginx on Ubuntu 18.04

Publish Date:2025/04/07 Views:86 Category:OPERATING SYSTEM

WordPress is one of the most popular open source content management systems (CMS) with a market share of up to 60% compared to other CMS like Drupal or Joomla. WordPress can be used to develop any type of website, be it a blog, a small busi

Linux: How to install htop on Ubuntu and Mint

Publish Date:2025/04/06 Views:129 Category:OPERATING SYSTEM

While top the htop utility provides us with basic information about the processes running on our Linux system, the htop utility goes a step further and provides us with more information about the processes and also allows for several operat

Configuring Apache Web Server on Ubuntu and Debian

Publish Date:2025/04/05 Views:176 Category:OPERATING SYSTEM

This article shows you how to install Apache web server on Ubuntu and Debian, set it up, and access the access logs. Apache Web Server in Ubuntu and Debian Apache HTTP Server is a free and open source web server that is very popular. More t

Scan to Read All Tech Tutorials

Social Media
  • https://www.github.com/onmpw
  • qq:1244347461

Recommended

Tags

Scan the Code
Easier Access Tutorial