Skip to content
Advertisement

GCC not added to system path on pacman install

Issue

When installing mingw on a fresh MSYS2 instance I run into the issue of gcc not found:

$ g++
bash: g++: command not found

Setup

Fresh MSYS2 install on relatively clean windows 10 install:

pacman -Syu 
pacman -Su 
pacman -S make 
pacman -S mingw-w64-x86_64-gcc 

Diagnostics

It appears that GCC is successfully installed into the directory /mingw64/bin

Yet my path consists of

/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:

As such gcc is not found.

I have tried adding /mingw64/bin to the $PATH however this seems like a temporary fix of an underlying problem.


My question specifically is, is there any reason as to why either the mingw is not installed into the /usr/bin/ directory or the installation did not add itself to the path, and or any simple reason as to what is causing this.

Thanks in advance!

Advertisement

Answer

Since you installed mingw-w64-x86_64-gcc it seems like you want to compile 64-bit native Windows applications. Therefore, you should start MSYS2 by running mingw64.exe, found at the top level of your MSYS2 installation. That will put /mingw64/bin/ on your PATH and set some other useful environment variables.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement