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

Answer from David L. on Stack Overflow
🌐
Reddit
reddit.com › r/learnprogramming › can't seem to make msys2 gcc work at all
r/learnprogramming on Reddit: Can't seem to make MSYS2 GCC work at all
June 4, 2023 -

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

🌐
Stack Overflow
stackoverflow.com › questions › 61713451 › using-git-bash-unable-to-compile-c-code-gcccommand-not-found
Using Git Bash unable to compile C code: "gcc:command not found" - Stack Overflow
Possible duplicate of this stackoverflow.com/questions/25705726/… ... I was having a similar problem - assuming you are using windows, make sure your downloaded MinGW folder is in your GIT folder (C:\Program Files\Git\MinGW).
🌐
Reddit
reddit.com › r/programminghelp › how to run gcc on windows 11? i installed it (correctly) based on the instructions on msys2 and visual studio's websites, but it doesn't execute code
r/programminghelp on Reddit: How to run GCC on Windows 11? I installed it (correctly) based on the instructions on MSYS2 and Visual Studio's websites, but it doesn't execute code
February 17, 2022 -

Not sure if this counts, since this is more about running code than writing it.

I have followed the instructions on these sites. I have also made sure to change "Path" in the environmental variables. https://code.visualstudio.com/docs/cpp/config-mingw https://www.mingw-w64.org/

The installation worked, but no matter what I try (running in command prompt, running in Visual Studio) I get something like: "'g++' is not recognized as an internal or external command, operable program or batch file." when I try to execute some code. Why is this?

EDIT 1: Visual Studio Code*, not Visual Studio.

EDIT 2: Seems to be working now! I'm the only user on my computer, but I had to change my system variables - not just the user variables - for it to work.

🌐
Delft Stack
delftstack.com › home › howto › linux › solve gcc command not found error in bash
How to Solve GCC Command Not Found Error in Bash | Delft Stack
March 11, 2025 - For example, if GCC is located in /usr/local/bin/gcc, you would add the following line to your .bashrc or .bash_profile: ... Now, try running the gcc --version command again. If everything is set up correctly, you should see the version number ...
🌐
CodeWithHarry
codewithharry.com › blogpost › solved-gcc-not-recognized-error-windows
[Solved] gcc: The term 'gcc' is not recognized as the name of a cmdlet, function... | Blog | CodeWithHarry
At line:1 char:1 + gcc + ~~~~ + ... a cmdlet, function, script file, or operable program." occurs for two primary reasons: Reason 1: Absence of the gcc compiler on your computer....
Find elsewhere
🌐
Reddit
reddit.com › r/c_programming › i downloaded and installed mingw. typing gcc in the windows command line prints: gcc is not recognized as an internal or external command
I downloaded and installed MinGW. Typing gcc in the Windows command line prints: gcc is not recognized as an internal or external command : r/C_Programming
September 14, 2024 - Check by typing SET PATH. Or just type gcc and see what happens. ... Well check if the path matches with the directory where gcc.exe is located. ... Navigate to the directory where gcc is located (either with cd, or by navigating in explorer.exe and typing cmd in the path bar) and try out whether ...
🌐
GitHub
gist.github.com › alandsilva26 › 53cd2fecf253554c2f671766d3df5d66
Instructions for installing GCC Compiler on Windows · GitHub
April 26, 2026 - Note: IF you get the following error gcc is not recognized as an internal or external command GCC may not be added to your path
🌐
Reddit
reddit.com › r/askprogramming › can't install gcc in msys2 environment
r/AskProgramming on Reddit: Can't install gcc in MSYS2 environment
March 29, 2025 -

Hi,

I have installed gcc in Windows 11 environment, but I want to execute gtk, I searched the following link:

https://www.msys2.org/

I installed msys2-x86_64-2025221.exe

After that I tried the following command:

pacman -S mingw-w64-ucrt-x86_64-gcc

but finally gcc is not working please guide me.

The output is:

MSYS ~
$ pacman -S mingw-w64-ucrt-x86_64-gcc
resolving dependencies...
looking for conflicting packages...

Packages (16) mingw-w64-ucrt-x86_64-binutils-2.44-1
              mingw-w64-ucrt-x86_64-crt-git-12.0.0.r576.g49111ba98-1
              mingw-w64-ucrt-x86_64-gcc-libs-14.2.0-3  mingw-w64-ucrt-x86_64-gettext-runtime-0.24-1
              mingw-w64-ucrt-x86_64-gmp-6.3.0-2
              mingw-w64-ucrt-x86_64-headers-git-12.0.0.r576.g49111ba98-1
              mingw-w64-ucrt-x86_64-isl-0.27-1  mingw-w64-ucrt-x86_64-libiconv-1.18-1
              mingw-w64-ucrt-x86_64-libwinpthread-git-12.0.0.r576.g49111ba98-1
              mingw-w64-ucrt-x86_64-mpc-1.3.1-2  mingw-w64-ucrt-x86_64-mpfr-4.2.1-2
              mingw-w64-ucrt-x86_64-windows-default-manifest-6.4-4
              mingw-w64-ucrt-x86_64-winpthreads-git-12.0.0.r576.g49111ba98-1
              mingw-w64-ucrt-x86_64-zlib-1.3.1-1  mingw-w64-ucrt-x86_64-zstd-1.5.7-1
              mingw-w64-ucrt-x86_64-gcc-14.2.0-3

Total Download Size:    65.83 MiB
Total Installed Size:  519.08 MiB

:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
 mingw-w64-ucrt-x86_64-gcc-...    43.5 MiB  14.3 MiB/s 00:03 [###############################] 100%
 mingw-w64-ucrt-x86_64-isl-...  1453.5 KiB   420 KiB/s 00:03 [###############################] 100%
 mingw-w64-ucrt-x86_64-libi...   725.4 KiB   930 KiB/s 00:01 [###############################] 100%
 mingw-w64-ucrt-x86_64-gcc-...  1021.6 KiB   823 KiB/s 00:01 [###############################] 100%
 mingw-w64-ucrt-x86_64-zstd...   642.3 KiB  2.55 MiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-gmp-...   578.5 KiB   963 KiB/s 00:01 [###############################] 100%
 mingw-w64-ucrt-x86_64-mpfr...   535.7 KiB  1739 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-mpc-...   128.3 KiB   594 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-gett...   311.6 KiB   499 KiB/s 00:01 [###############################] 100%
 mingw-w64-ucrt-x86_64-zlib...    92.1 KiB   165 KiB/s 00:01 [###############################] 100%
 mingw-w64-ucrt-x86_64-winp...    39.8 KiB   128 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-binu...     6.0 MiB   994 KiB/s 00:06 [###############################] 100%
 mingw-w64-ucrt-x86_64-head...     6.4 MiB  1046 KiB/s 00:06 [###############################] 100%
 mingw-w64-ucrt-x86_64-libw...    28.6 KiB  97.4 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-wind...     3.0 KiB  12.9 KiB/s 00:00 [###############################] 100%
 mingw-w64-ucrt-x86_64-crt-...     4.6 MiB   679 KiB/s 00:07 [###############################] 100%
 Total (16/16)                    65.8 MiB  9.35 MiB/s 00:07 [###############################] 100%
(16/16) checking keys in keyring                             [###############################] 100%
(16/16) checking package integrity                           [###############################] 100%
(16/16) loading package files                                [###############################] 100%
(16/16) checking for file conflicts                          [###############################] 100%
(16/16) checking available disk space                        [###############################] 100%
:: Processing package changes...
( 1/16) installing mingw-w64-ucrt-x86_64-libwinpthread-git   [###############################] 100%
( 2/16) installing mingw-w64-ucrt-x86_64-gcc-libs            [###############################] 100%
( 3/16) installing mingw-w64-ucrt-x86_64-libiconv            [###############################] 100%
( 4/16) installing mingw-w64-ucrt-x86_64-gettext-runtime     [###############################] 100%
( 5/16) installing mingw-w64-ucrt-x86_64-zlib                [###############################] 100%
( 6/16) installing mingw-w64-ucrt-x86_64-zstd                [###############################] 100%
( 7/16) installing mingw-w64-ucrt-x86_64-binutils            [###############################] 100%
( 8/16) installing mingw-w64-ucrt-x86_64-headers-git         [###############################] 100%
( 9/16) installing mingw-w64-ucrt-x86_64-crt-git             [###############################] 100%
(10/16) installing mingw-w64-ucrt-x86_64-gmp                 [###############################] 100%
(11/16) installing mingw-w64-ucrt-x86_64-isl                 [###############################] 100%
(12/16) installing mingw-w64-ucrt-x86_64-mpfr                [###############################] 100%
(13/16) installing mingw-w64-ucrt-x86_64-mpc                 [###############################] 100%
(14/16) installing mingw-w64-ucrt-x86_64-windows-default...  [###############################] 100%
(15/16) installing mingw-w64-ucrt-x86_64-winpthreads-git     [###############################] 100%
(16/16) installing mingw-w64-ucrt-x86_64-gcc                 [###############################] 100%

zulfi@DESKTOP-070V6RM MSYS ~
$ gcc --version
-bash: gcc: command not found

However, gcc is already working on my computer on windows shell,

c:\msys64>gcc
gcc: fatal error: no input files
compilation terminated.

I want to install gtk.

Somebody please guide me.

Zulfi.

Top answer
1 of 1
3
To use the GCC version installed, you need to launch not the base MSYS prompt, but the UCRT64 one. (Hopefully) MSYS2 has installed multiple shortcuts for you, if you look at the start menu you should see one that has UCRT64 in the name. When you launch it correctly your prompt will look like e.g. zulfi@DESKTOP-070V6RM UCRT64 ~ $ It's this shell because you installed mingw-w64-ucrt-x86_64-gcc, notice the "ucrt" in the name there. For some background - Why does this happen? MSYS2 docs don't explain this well, but there are "2 layers" of the MSYS2 system. There's the top level one (just called MSYS) that provides the unix tools and the shell, but these tools rely on a compatability layer to work on windows (provided by msys-2.0.dll). Below that, the environment lets you install compilers that generate code for a native toolchain (can run on windows without any compatability stuff), but this is complicated by multiple options due to legacy. UCRT64 is the recommended one for starting out which is why it's in the docs. But since there are other options, MSYS2 provides multiple shells so you can have compilers for multiple different toolchains installed at the same time without breaking each other. So the compiler you installed ucrt-x86_64-gcc means: ucrt = ucrt C runtime library; x86_64 = 64 bit windows; gcc = the GCC compiler (Clang is the other option). To put it simply, do your programming for now in the UCRT64 shell and it should work. But to installations/updates from the main MSYS shell.
🌐
Stack Overflow
stackoverflow.com › questions › 48217902 › why-does-the-gcc-command-not-work-on-windows-command-line-but-works-on-git-bash
Why does the gcc command not work on Windows command line, but works on Git Bash? - Stack Overflow
January 12, 2018 - gcc -- version 'gcc' is not recognized as an internal or external command, operable program or batch file. But when I run it on Git Bash, the command executes properly.
🌐
Edaboard
edaboard.com › eda software › software problems, hints and reviews
gcc is not recognized as an internal or external command | Forum for Electronics
June 16, 2018 - Click to expand... I observed one thing, if i restart the system and after that I type Command :gcc -o test test.c it give the error. gcc is not recognized as an internal or external command.
🌐
Narkive
cygwin.cygwin.narkive.com › YeOR735g › help-with-using-bash-gcc-installed-but-command-not-found
Help with using Bash / GCC installed but command not found
June 26, 2009 - Until one day I loaded it up and instead of the usual interface I had, it just said bash-3.2$, no username, or directory or anything, and none of the unix commands work. My guess is that your Windows HOME environment variable was set, changed, or unset, either by you or by some program you ran (including setup.exe for some other application). (Vista: Start -> Control Panel -> System -> Advanced System Settings -> Environment Variables.) Over the years, I've found that Cygwin Bash works best when Windows HOME is not set.
🌐
Reddit
reddit.com › r/olkb › qmk error avr-gcc: command not found
r/olkb on Reddit: QMK Error avr-gcc: command not found
December 30, 2021 -

I tried to compile a default key map and get the error message "sh: avr-gcc: comand not found".

When using make iris/rev2:default following error message appeared.

$ make iris/rev2:default
QMK Firmware 0.6.246
Making iris/rev2 with keymap default

/bin/sh: avr-gcc: command not found
sh: avr-gcc: command not found
sh: avr-gcc: command not found
make[1]: *** [tmk_core/rules.mk:256: gccversion] Error 127
Make finished with errors
make: *** [Makefile:544: iris/rev2:default] Error 1

I use windows10 and Msys2 64bit with "MSYS2 MinGW 64-bit".

I tried following to solve this error, but didn't solve the problem.

reinstall msys2 and qmk

rerun util/qmk_install.sh

run echo 'export PATH="/usr/local/opt/avr-gcc@7/bin:$PATH"' >> ~/.bash_profile and restart terminal

run pacman -S avr-gcc and "Error target not found: avr-gcc" appeared.

This is my first time of building key map, then I'm a beginner.

Any information would greatly help.

🌐
Reddit
reddit.com › r/git › how do i run/install gcc on gitbash?
r/git on Reddit: How do i run/install gcc on gitbash?
February 10, 2021 - Or the Git for Windows SDK. ... b) not recommended. It's probably better to use gcc via Msys/MinGW or WSL (depending on what you want to build software for).
🌐
GitHub
github.com › rdp › ffmpeg-windows-build-helpers › issues › 95
/bin/sh: gcc: command not found · Issue #95 · rdp/ffmpeg-windows-build-helpers
October 31, 2015 - -f /cygdrive/d/tmp/ffmpeg-windows-build-helpers/native_build/ffmpeg_local_builds/sandbox/win32/quick_install/install_root/lib/libfdk-aac.a ]] + [[ ! -f /cygdrive/d/tmp/ffmpeg-windows-build-helpers/native_build/ffmpeg_local_builds/sandbox/win32/quick_install/install_root/lib/libx264.a ]] + [[ ! -d ffmpeg_fdk_aac ]] + cd ffmpeg_fdk_aac + [[ ! -f config.mak ]] + rm '**/*.a' rm: cannot remove '**/*.a': No such file or directory + make -j5 install CC libavdevice/utils.o CC libavdevice/vfwcap.o HOSTCC doc/print_options.o /bin/sh: gcc: command not found CC libavfilter/aeval.o common.mak:138: recipe for target 'doc/print_options.o' failedCC libavfilter/af_adelay.omake: *** [doc/print_options.o] Error 127 make: *** Waiting for unfinished jobs....
Author   rdp
🌐
Windows Command Line
windows-commandline.com › gcc-not-recognized-internal-external-command
GCC is not recognized as internal or external command
May 21, 2016 - I was wondering if any steps existed to help with a similar error, but I am trying to use the “g++” command prompt. I tried to do these steps, but was not sure if I did it right or if it would even work for “g++.” ... i have seen everything and done all the setting as per instructions , but is now also showing gcc is not recognised……….. ... Thank You so much. Last 2 points helped me a lot. ... The string was not found even though I did what you instructed the error program that reads after set path | findstr