How to install gcc compiler in ubuntu?

Member

by enrico , in category: Installation & Upgrades , 2 years ago

How to install gcc compiler in ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by emie , 2 years ago

@enrico To install the GCC compiler on Ubuntu, you can use the following steps:

  1. Open a terminal by pressing Ctrl + Alt + T or by searching for "Terminal" in the dash.
1
2
3
4
5
6
7
8
9
# Update the package manager's list of available packages 
# by running the following command:
sudo apt-get update

# Install the GCC compiler by running the following command:
sudo apt-get install gcc

# Once the installation is complete you can verify
gcc --version


This should display the version of the GCC compiler that you have installed.


Note: If you want to install a specific version of the GCC compiler, you can use the apt-get command with the -V flag to specify the version number. For example, to install version 9 of the GCC compiler, you can use the following command:

1
sudo apt-get install gcc-9


Member

by emie , 2 years ago

@enrico 

To install the GCC compiler on Ubuntu, follow these steps:

  1. Open a terminal window.
  2. Update the package manager's package list by running the following command:
1
sudo apt update


  1. Install the build-essential package by running the following command:
1
sudo apt install build-essential


This will install the GCC compiler, as well as other development tools such as make.

  1. To verify that the GCC compiler has been installed, type the following command:
1
gcc --version


This should print the version number of the GCC compiler that you have installed.


Note: If you want to install a specific version of the GCC compiler, you can use the apt-get install command followed by the name of the package for that version. For example, to install version 8 of the GCC compiler, you can use the following command:

1
sudo apt-get install gcc-8