How To Install GCC (Build-Essential) On Ubuntu 20.04 - Linuxize
How To Install GCC (Build-Essential) On Ubuntu 20.04 - Linuxize
04 | Linuxize
The GNU Compiler Collection (GCC) is a collection of compilers and libraries for C, C++, Objective-C, Fortran, Ada, Go
,
and D programming languages. A lot of open-source projects, including the Linux kernel and GNU tools, are compiled
using GCC.
To install the Development Tools packages, run the following command as root or user with sudo privileges
:
The command installs a lot of packages, including gcc , g++ and make .
You may also want to install the manual pages about using GNU/Linux for development:
https://linuxize.com/post/how-to-install-gcc-on-ubuntu-20-04/ 1/6
20/07/2022 20:49 How to Install GCC (build-essential) on Ubuntu 20.04 | Linuxize
Verify that the GCC compiler is successfully installed by running the following command that prints the GCC version:
$ gcc --version
Output
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
This is free software; see the source for copying conditions. There is NO
That’s it. GCC tools and libraries have been installed on your Ubuntu system.
$ nano hello.c
hello.c
// hello.c
#include <stdio.h>
int main() {
printf("Hello, world!\n");
return 0;
This creates a binary file named hello in the same directory where you run the command.
https://linuxize.com/post/how-to-install-gcc-on-ubuntu-20-04/ 2/6
20/07/2022 20:49 How to Install GCC (build-essential) on Ubuntu 20.04 | Linuxize
$ ./hello
Output
Hello World!
At the time of writing this article, the default Ubuntu repositories include several GCC versions, from 7.x.x to
10.x.x .
In the following example, we will install the latest three versions of GCC and G++.
The commands below configures alternative for each version and associate a priority with it. The default version is the
one with the highest priority, in our case that is gcc-10 .
https://linuxize.com/post/how-to-install-gcc-on-ubuntu-20-04/ 3/6
20/07/2022 20:49 How to Install GCC (build-essential) on Ubuntu 20.04 | Linuxize
Later if you want to change the default version use the update-alternatives command:
Output
------------------------------------------------------------
You will be presented with a list of all installed GCC versions on your Ubuntu system. Enter the number of the version
you want to be used as a default and press Enter .
Conclusion
We’ve shown you how to installed GCC on Ubuntu 20.04. You can now visit the official GCC Documentation
page and
learn how to use GCC and G++ to compile your C and C++ programs.
gcc ubuntu
BUY ME A COFFEE
Sign up to our newsletter and get our latest tutorials and news straight
to your mailbox.
Your email...
https://linuxize.com/post/how-to-install-gcc-on-ubuntu-20-04/ 4/6
20/07/2022 20:49 How to Install GCC (build-essential) on Ubuntu 20.04 | Linuxize
Subscribe
Related Articles
DEC 3, 2020
https://linuxize.com/post/how-to-install-gcc-on-ubuntu-20-04/ 5/6
20/07/2022 20:49 How to Install GCC (build-essential) on Ubuntu 20.04 | Linuxize
NOV 21, 2020
How to Install Flask on Ubuntu 20.04
© 2022 Linuxize.com
Privacy Policy
Terms
Contact
Advertise on Linuxize
https://linuxize.com/post/how-to-install-gcc-on-ubuntu-20-04/ 6/6