It seems that your Go installation is still using Cygwin distribution to invoke gcc
very likely because of PATH
environment variable setting. Try prepending your PATH
environment variable with path to Mingw64 distribution bin\
directory (this will not persist so you need to try go run
in same Command Line window):
set PATH=C:\Path\To\Mingw64\Installation\bin;%PATH%
go run whatever.go
(NOTE: make sure you have \bin
there. If your Mingw64 distro is installed in C:\Mingw64
it will be C:\Mingw64\bin
)
If above helped and you want to fix this permanently (and you don't depend on Cygwin tools in Command Line as doing below will replace some commands with Mingw64 ones) make sure that in your PATH
environment variable path to Mingw64 is before the Cygwin path. You can do this by doing following:
- Press Windows Key + R to bring up Run dialog
- Type
rundll32.exe sysdm.cpl,EditEnvironmentVariables
and press Enter to bring System variables dialog
- In the top section called User variables for USERNAME double-click the row where Variable column is
Path
to bring up Edit Environment Variable dialog
- Now check if row where is path to your Mingw64 installation /bin directory is above the row where path to your Cygwin installation /bin directory is. If it is below click on it to select it and click Move Up button as many times as needed to bring it above Cygwin path.
- Once done close both dialogs with OK button
While you can install mingw64 packages in Cygwin it is very likely not compatible with Go tooling and official documentation recommends Mingw64/MSYS as a compiler suite to get gcc
- I strongly recommend using latest distribution linked in documentation.