Set up gcc and g++ for development on Linux

By Lenny Metlitsky @leomet07

To install the C and C++ compilers of the GNU project, you need to install a couple packages. This includes the gcc/g++ compilers themselves, cmake, and some other dependencies. Here are the commands for some common distributions:

Alpine

apk add build-base

Source: https://wiki.alpinelinux.org/wiki/GCC

Fedora (and its derivatives)

dnf groupinstall 'Development Tools'

Arch Linux (and its derivatives)

pacman -S --needed base-devel

Ubuntu/ Debian (and their derivatives)

apt install build-essential

Void Linux

xbps-install gcc
xbps-install cmake

Note: The above command also installs g++ and make

That's it!

gcc, g++, and cmake should now be installed and ready to be used for compiling programs or development.

go home