Some of the tutorials showing how to install gcc on Debian are misleading.
sudo apt install build-essential is not required.
The Debian website states the build-essential package is unnecessary unless you’re planning to build Debian packages:
https://packages.debian.org/bookworm/build-essential
This is an excerpt taken from the above website:
If you do not plan to build Debian packages, you don’t need this package. Starting with dpkg (>= 1.14.18) this package is required for building Debian packages.
Here is another way to install gcc:
1. sudo apt update && sudo apt upgrade
2. sudo apt install gcc
Every required package will be included other than some extra tools you might want to get, such as make, cmake, gdb, etc.
Note that if you install g++ using sudo apt install g++, gcc will be included in the package.
-MOOD