You can install gcc by running setup-x86.exe or setup-x86_64.exe again. The gcc package is in the Devel category:

Can't seem to make MSYS2 GCC work at all
windows - gcc is recognized by cmd, but not by bash - Stack Overflow
/bin/sh: gcc: command not found
Why does the gcc command not work on Windows command line, but works on Git Bash? - Stack Overflow
Videos
the instalation of GCC seemed to work fine, but when i run gcc -- version, i get greeted by "bash:gcc: command not found" response. i followed the instructions with every step. what could be the issue?
I found a fix thanks to chatgpt ( who would've thought). turns out the MSYS2 link from the vs code page was simply outdated, so i used this one from the MSYS2 page and ran the commands in the ucrt window. I will leave this here in hopes someone else finds and needs this
Maybe simple...
sudo apt-get install gcc
... could be enough?
Do this: open a terminal and type gcc --version. Does anything come up?
Alternatively, search for the gcc executable, which should be located in /usr/bin.
Do ls /usr/bin | grep gcc. What output do you get from that command?
If you get no output from either command, then you need to find your gcc executable wherever you installed it (somewhere in /usr/share maybe?). When found, do cd /usr/bin && ln -s [ABSOLUTE PATH OF GCC].
If you got no output from the first, but output from the second, then you have serious trouble, because /usr/bin is not in your PATH. Edit the file /etc/environment and ADD the following line to the end of the document: PATH="$PATH:/usr/bin".
If you got output from the first, then there is a problem somewhere with bash not reading its own PATH. I think hell would freeze before the first works, but watch you prove me wrong and freeze hell for me. :)
Hope this helps! +1 me if it does!
(Copying information from comments.)
The fact that your C:\MinGW\bin directory is nearly empty (that's where gcc.exe and g++.exe should be) indicates that you haven't finished installing MinGW.
See MinGW's Getting Started page for instructions.
For those who have mingw codeblocks installed, they should add this path to PATH variable in environment variables after a semicolon :
C:\Program Files (x86)\CodeBlocks\MinGW\bin
May vary with your install directory of Codeblocks
Also i have observed that if u have two paths for maybe two gcc installations in PATH variable in environment variables; You will still encounter the msg :
gcc is not recognised as an internal or external command