How to install and use build essential tools on ubuntu 22. 04

How to Install and Use Build Essential Tools on Ubuntu 22.04

Before proceeding towards installing and using the build-essential tools, we will first understand what they are and how they help us? This is the package available in Ubuntu that contains the dependencies of other packages, especially the Debian packages and the compilers for different programming languages.

This write-up will help you understand the installation procedure of Build essentials on Ubuntu with the example of its usage.

How to install and use Build Essential Tools on Ubuntu?

For the installation of the build-essential tools package from the official repository of Ubuntu, execute the mentioned-below command:

$
Sponsored
sudo apt install build-essential -y

How to install and use build essential tools on ubuntu 22. 04 1

Well, as it has been discussed in the above section that the package of build-essential contains different compilers so to validate this statement, we will check the installed version of the GCC compiler that is included in the build essentials tools and is used to compile the code of C programming language:

$ gcc –version

How to install and use build essential tools on ubuntu 22. 04 2

In the above output, the version “11.2.0” of GCC is confirming that it has been installed, with the installed packages of Build Essentials.

To confirm the working of the compiler, we will write a simple C program to display the “Welcome to the LinuxHint” message. So, we will create a file with the name of “MyCfile” with the nano text editor:

$ nano MyCfile.c

How to install and use build essential tools on ubuntu 22. 04 3

Copy and paste the below script in your opened nano editor in the terminal:

#include

int main() {

Sponsored

printf(“Welcome to the LinuxHint!n);

return 0;

}

How to install and use build essential tools on ubuntu 22. 04 4

Once pasted, save the file using the “CTRL+S” shortcut key and exit from the nano editor using “CTRL+X”.

Now, compile the file with the gcc compiler and save it in a new file using the command:

$ gcc MyCfile.c -o MyCfile

How to install and use build essential tools on ubuntu 22. 04 5

As we can see that there is no error and the file has been successfully compiled.

Run the C code to display the output:

$ ./MyCfile

How to install and use build essential tools on ubuntu 22. 04 6

The displayed message confirmed that the GCC compiler installed using build essential tools is working perfectly.

Conclusion

Execute the “sudo apt install build-essential” command and it will install all the necessary packages to install build-essential tools on Ubuntu 22.04. Build essential tools contain the dependencies tools of different packages and compilers. In this blog, we have explained the installation method of Build Essential tools and its usage on Ubuntu using the command line interface.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply