2

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"
}
Obed Amoasi
  • 1,837
  • 19
  • 27
RAT
  • 31
  • 5
  • 1
    When you run msys outside of the Terminal, what's the path to the compiler? Is that directory still on the PATH when you run inside of the Windows Terminal? You may want to refer to [this doc](https://github.com/microsoft/terminal/blob/main/doc/user-docs/ThirdPartyToolProfiles.md#git-bash) which has some subtle differences between git bash and msys2 – zadjii Feb 17 '22 at 20:38
  • The path is the same one for the download `C:\msys64\...` – RAT Feb 18 '22 at 09:43

1 Answers1

5

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

Weed Cookie
  • 579
  • 1
  • 3
  • 11