gdbmingw-w64

gdb not found when setting up Mingw-64w in VSCode


Following the documentation provided by VSCode for C++ provided on this link: https://code.visualstudio.com/docs/languages/cpp, I ran into trouble when checking the MinGW installation. When I ran gdb --version I got this:
$ gdb --version
-bash: gdb: command not found


Solution

    1. Make sure you have followed the MinGW installation as in https://www.msys2.org/ or if you were using installer from link to installer to install MYSYS then you have to continue from step 5 to install required compiler tools use following command insted of step 6 command

    pacman -S --needed base-devel mingw-w64-x86_64-toolchain

    1. You should add the same Installation Folder used in step 3 of installation instruction to the system PATH variable or if you have used installer to install the MinGW find the MinGW installation directory by opening your C drive and add that path to system PATH (in my case Ex: C:\msys64\mingw64\bin)

    2. Make sure the C:\msys64\mingw64\bin is not empty, if it's empty mostly you haven't continued from the step 5 after installing MYSYS from installer

    3. After adding system PATH, close and open cmd window just type path in cmd and enter to make sure your MinGW path is addedd to system PATH, (you can copy paste the output to notepad/notepad++ and search MinGW to find the path)

    4. Once MinGW is in the path your gdb command should work (please provide this screenshot of path command output, if it's still didn't work)