How to Install GCC on Ubuntu
GCC (GNU Compiler Collection) is a set of tools for compiling source code from various programming languages into binaries, executables, or libraries. GCC is a command-line compiler that may be installed on Ubuntu.
How to Install GCC on Ubuntu Method 1: Through Ubuntu Terminal Option 1: Install a Particular GCC Version Option 2: Install Multiple GCC Versions Method 2: Through Synaptic Package Manager Option 1: Install a Particular GCC Version Option 2: Install Multiple GCC Versions
The GCC compiler, as well as many libraries and other tools necessary for generating applications, is included in the default Ubuntu repository as build-essential. C, C++, Java, Objective-C, Go, Fortran, Ada, and more programming languages are supported by GCC. Many open-source projects, including the GNU utilities and the Linux kernel, require GCC to build their code.
This tutorial will show you how to set up the GCC compiler on Ubuntu 18.04. We’ll teach you how to install the stable version of the distribution as well as the most recent version of GCC. The steps are the same for Ubuntu 16.04 and any Ubuntu-based distribution, such as Kubuntu, Linux Mint, and Elementary OS. Note: You must be logged in as root or a user with sudo privileges to create new repositories and install packages on your Ubuntu system.
Method 1: Through Ubuntu Terminal
To set up GCC on Ubuntu, you’ll need to download and install the build-essential package. Open a terminal window to download gcc ubuntu. Follow the given steps to install GCC on Ubuntu through the Terminal.
Option 1: Install a Particular GCC Version
Press Ctrl + Alt + T keys together to launch a terminal window on the Desktop. Note: Alternatively, go to the app menu and search for Terminal.
Use the install command below to install the build-essential package on Ubuntu once the terminal window is open. sudo apt install build-essential Note: The Sudo command prompts you for your password. Users can use this command to run a single task as root.
Ubuntu will prompt you for your password. Enter your user password to continue.
The terminal prompt will gather all dependencies for the build-essential package once you’ve supplied your password. Ubuntu will next ask you whether or not you wish to install the package. To proceed, press the Y key. When you hit the Y key, Ubuntu will begin installing GCC on your machine.
This procedure should take no more than a few minutes. With the man gcc command, you may browse the GCC documentation after the procedure is complete. Also Read: Top 14 Best Graphics Card for Linux
Option 2: Install Multiple GCC Versions
While most Ubuntu users will be satisfied with the build-essential package because it contains GCC 10, it is not the only version of GCC available. Support for additional languages, improved performance, and expanded functionality are all included in newer versions of the GCC compiler. You have the option of installing various versions of GCC on Ubuntu. Here’s how to download gcc ubuntu.
First, on the Ubuntu desktop, open a terminal window.
Once it’s open, use the following command to search the Ubuntu software repositories for available GCC packages: apt search gcc
Search through the prompt for the GCC version you want to install on Ubuntu. GCC 7, GCC 8, 9, and 10 will be available for installation.
Install GCC using the apt install instructions below once you’ve found the version you want to install on your Ubuntu PC. gcc-7, gcc-8, gcc-9, and gcc-10 are GCC packages.
To install the GCC version 7 on Ubuntu. sudo apt install gcc-7 g++-7
To install GCC version 8 on Ubuntu. sudo apt install gcc-8 g++-8
To install the GCC version 9 on Ubuntu. sudo apt install gcc-9 g++-9
While installing the build-essential package is strongly recommended for getting GCC 10 to operate on Ubuntu, it isn’t the only option to do it. Installing the gcc-10 and g++-10 packages will also install GCC 10. sudo apt install gcc-10 g++-10
Also Read: 20 Best Lightweight Linux Distros of 2022
Method 2: Through Synaptic Package Manager
If you don’t want to use the console to install GCC on Ubuntu, you may use the Synaptic Package Manager instead to download GCC in ubuntu.
Option 1: Install a Particular GCC Version
Follow these steps to install GCC through Synaptic Package Manager.
To begin, make sure Synaptic is installed. To get Synaptic, go to the Ubuntu Software program and search for Synaptic, then install it.
Open the Synaptic Package Manager by searching for it in the app menu once it has been installed.
Then, in the top-right corner of the screen, look for the search button.
To display the search results, pick the Synaptic search button and input build-essential followed by the Enter key.
Look through Synaptic search results for build-essential.
Once you’ve identified it, right-click on it and choose the Designate for installation option to mark the build-essential package for Synaptic installation.
In Synaptic, locate the Apply button and click it to begin the GCC installation on Ubuntu.
Also Read: How To Install Linux Bash Shell On Windows 10
Option 2: Install Multiple GCC Versions
To install a GCC version other than the one supplied with the build-essential package in Ubuntu, perform the steps below.
- First, open Synaptic Package Manager.
- Once Synaptic is open, click on the search button.
- Then select one of the products from the list below and enter it into the search box.
GCC 7: gcc-7, g++-7 GCC 8: gcc-8, g++-8 GCC 9: gcc-9, g++-9 GCC 10: gcc-10, g++-10
To install the GCC package(s) you’ve found in Synaptic, right-click on it and pick the Apply button.
Repeat this procedure as needed to install as many versions of GCC as you like on Ubuntu. Q1. Is GCC already installed on your Ubuntu? Ans. On all Ubuntu desktop variants, the GCC package is installed by default. Q2. Which command is used to install GCC? Ans. Install GNI C/C++ (GCC) and needed libs using the up2date command, yum command, or apt-get command, depending on your Linux distro. Q3. What is the purpose of Ubuntu? Ans. Ubuntu has everything you’ll need to manage your company, school, house, or business. All of the main software, like an office suite, browsers, email, and media apps, are pre-installed, and the Ubuntu Software Centre has hundreds of additional games and applications. Recommended:
How to Find Sleep Button on Windows 10 How to Send GIFs in Slack How to Keep Microsoft Teams Status Available How to Send Skype Code with Proper Format
We hope this article will prove to be helpful in finding out how to install gcc Ubuntu. You can find many more articles related to tech on our website. If you have any suggestions or feedback regarding this article, you can reach out to us in the comment section below.