Ubuntu Linux Install GNU GCC Compiler and Development Environment

Ubuntu Linux Install GNU GCC Compiler and Development Environment

To install the GNU GCC compiler and development environment on Ubuntu Linux, you will need to have root privileges or access to a user with sudo privileges.

  1. First, update the package repository by running the following command:
sudo apt update
Source:‮www‬.lautturi.com
  1. Install the build-essential package, which includes the GCC compiler and a set of development tools, by running the following command:
sudo apt install build-essential

This will install the GCC compiler, the GNU Make build tool, and a number of other development tools such as the C preprocessor, debugger, and libraries.

  1. Once the installation is complete, you can start using the GCC compiler. To compile a C program using GCC, run the following command:
gcc program.c -o program

Replace "program.c" with the name of your C source file and "program" with the name that you want to give to the executable file. This will compile the program and create an executable file called "program".

That's it! The GCC compiler and development environment should now be installed on your Ubuntu Linux system. You can use them to compile and build C and C++ programs.

Note: If you want to install a specific version of GCC, you can install it from the Ubuntu repositories or from a package file (".deb"). To install from the repositories, use the "apt-get" command with the "--version" option. For example, to install GCC 9, you can run the following command:

sudo apt-get install gcc=9*

To install from a package file, download the appropriate package file from the GCC website (https://gcc.gnu.org/) and install it using the "dpkg" command. For example:

sudo dpkg -i gcc-9.3.0.deb

Replace "gcc-9.3.0.deb" with the name of the package file that you downloaded.

Created Time:2017-10-30 14:27:25  Author:lautturi