29 C
Jaipur
Tuesday, April 13, 2021

How to Install GCC compiler on Linux Mint 20 – Linux Hint

Must read

The GNU compiler collection, which is the abbreviation for GCC, contains multiple compilers for various languages like C, C++, Go, etc. Using GCC, you can easily compile your programs on Linux Mint. Many open-source projects, including Linux Kernel, are compiled using the GCC compiler.

The build-essential package contains the GCC compiler, debugger, and many additional development tools. By installing the build-essential package, we can use GCC compiler on Linux Mint.

Installing GCC compiler on Linux Mint 20

The build-essential package is included in the Linux Mint base repository. open the terminal and update the apt package listing by typing:

Now, install the build-essential package with the command:

$ sudo apt install build-essential

To continue installing the build-essential package, type ‘y’ on the command line.

Once the build-essentials package is installed, verify the GCC compiler installation with the command:

Getting started with GCC compiler on Linux Mint

Let’s compile our first C++ program with GCC compiler. Open your text editor and create a hello.cpp file:

#include

int main() {

    printf(“Hello from LinuxHint n);

    return 0;

}

To compile this C++ program with GCC compiler, write on your terminal

$ gcc <file-name>

$ gcc hello.cpp

My “hello.cpp” file is compiled successfully, and a new executable file, “a.out,” is created.

Let’s execute the ‘a.out’ file:

You can see that the message is printed on the terminal.

Conclusion

GCC compiler is used to compile the programming files on Linux. This post describes the installation of the GCC compiler on Linux Mint 20.

Source link

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article