How to Install GCC Compiler on Ubuntu 18.04
GCC
It 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 apt
install the compiler on Ubuntu using the command line tool GCC
. We must be logged in as a super user to use apt
installation GCC
.
Ubuntu
Install onGCC
In the default Ubuntu
repository, there is a build-essential
metapackage called that contains GCC
and various other compilers, such as g++
and make
.
We can also build-essentials
install it by installing the package GCC
. Once we install build-essential
the package, GCC
it is also installed in our system.
To install build-essential
, we follow the steps below.
Verify GCC
the installation of
We use the following command to verify GCC
whether the installation is successful.
gcc --version
If GCC
is installed successfully, we will get an output including the version and other GCC
information 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.
GCC
Compile 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_world
executable file called .
To run this executable, we use the command.
./hello_world
Installing multiple GCC
versions
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.
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 use Let's Encrypt with Nginx to configure https in Ubuntu 20.04
Publish Date:2025/04/07 Views:123 Category:OPERATING SYSTEM
-
Let's Encrypt is a Certificate Authority (CA) that provides an easy way to obtain and install free TLS/SSL certificates, enabling encrypted HTTPS on your web server. It simplifies the process by providing a software client, Certbot, which a
Detailed introduction on how to add and delete users on Ubuntu 18.04 system
Publish Date:2025/04/07 Views:88 Category:OPERATING SYSTEM
-
Adding and removing users on a Linux system is one of the most important system administration tasks we need to be familiar with. When a new system is created, usually only the root account is accessible by default. While running as the roo
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