Search code examples
windowsgccg++mingwmsys2

"bash: gcc: command not found" -- Error while installing GCC, GDB and G++ with MSYS2


I'm using that instruction to install MinGW, but face a problem on checking versions. The error that occuries after $ gcc --version looks like bash: gcc: command not found

I've already checked my environment variables Path (both User and System). The piece that I added to Path was C:\msys64\mingw64\bin;. Without any "" and with ;, as you can see. Also I checked bin folder and gcc and other files were there.

What could be the problem?


Solution

  • Set the environment variable path as C:\msys64\ucrt64\bin in case if you have installed gcc using pacman -S mingw-w64-ucrt-x86_64-gcc.

    OR

    You can install gcc using: pacman -S mingw-w64-x86_64-gcc and set environment variable path as C:\msys64\mingw64\bin.