msyswindows-terminal

Adding MSYS to windows terminal


I added bash on windows to windows terminal by editing the settings.json file, when I try to compile a simple hello world written in c++ it throws an error that gcc or g++ is not detected How to properly add MSYS bash terminal so that I can compile file from windows terminal

In settings.json I added the path to the bash shell like so :

{
  "commandline": "powershell.exe",
  "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
  "hidden": false,
  "name": "Windows PowerShell"
},
{
  "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
  "hidden": false,
  "name": "Azure Cloud Shell",
  "source": "Windows.Terminal.Azure"
},
{
  "commandline": "C:\\msys64\\usr\\bin\\bash.exe -i -l",
  "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
  "hidden": false,
  "name": "msys2"
},
{
  "guid": "{495d29da-4bfb-4956-abd8-ed1760703232}",
  "commandline": "cmd.exe",
  "hidden": false,
  "name": "cmd.exe"
}

Solution

  • I would recommend checking the docs for that but here is my own MSYS edit

    {
        "commandline": "C:\\msys64\\msys2_shell.cmd -defterm -here -no-start -mingw64 -shell bash",
        "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
        "hidden": false,
        "name": "msys2"
    }
    

    Use New-Guid in powershell to create a new guid