skip to Main Content

So I tried to check Mingw-w64 tools are correctly installed and gcc, g++ were correctly installed but gdb wasn’t. I’m planning to usE Visual studio code in windows 10.
In the https://code.visualstudio.com/docs/cpp/config-mingw#_run-helloworldcpp, it said to match PATH entry but when I went to C:msys64mingw64bin directory, the file was empty. Did I miss something or how do I know the correct path to put in the environment variable?

I tried C:msys64mingw64bin as both user variable & system variable path but it won’t work. and it said command not found.

This is what it said.
$ gdb –version

bash: gdb: command not found

3

Answers


  1. Try installing GDB by running this in your Bash shell:

    pacman -S $MINGW_PACKAGE_PREFIX-gdb
    
    Login or Signup to reply.
  2. I ran ‘$ pacman -S mingw-w64-ucrt-x86_64-gdb’ from ucrt64 directory. gdb package loaded and everything worked. Thank you, @HolyBlackCat !

    Background: I loaded Mingw-w64 today via ‘https://www.msys2.org/‘ after VS Code informed me my "intellisense" wasn’t set up after I loaded the Marlin extension (I’m a newbie. Just starting to get into Raspberry PI & Arduino). A VSCode link sent me to ‘https://code.visualstudio.com/docs/cpp/config-mingw‘. I followed the directions:’gcc –version’ and ‘g++ –version’ were fine, but like @IronMan829, ‘$ gdb –version’ gave "command not found" error and no gdb.exe anywhere under /msys64. @HolyBlackCat’s solution worked. gdb installed and VSCode saw it and Intellisense incorporated it automatically.

    Login or Signup to reply.
  3. $ pacman -S mingw-w64-ucrt-x86_64-gdb will not be enough.
    You will need the full UCRT64 Toolchain.

    Install Toolchain

    To use ucrt64 gcc compiler, you will need to follow the instructions of mentioned https://code.visualstudio.com/docs/cpp/config-mingw
    But instead of the mingW64 Toolchain you need to install the UCRT Toolchain (you can also have both of them, they go into different directories and don’t conflict, but you should only have one of them in your path at a time, so you can only use them one at a time).

    The command for this is

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

    Important:

    You have to enter this command into the msys-Console, which is kind of purple not the msys ucrt-console nor the msys MingW console if any of these are present.

    This will fill up your ucrt64 directory with a whole bunch of files.

    Setting Path

    If this directory is already correctly populated, you may not have set your path correctly.
    Do it as menioned in said https://code.visualstudio.com/docs/cpp/config-mingw , but again, use the

    C:msys64ucrt64bin
    

    instead of C:msys64mingw64bin(if you followed the standard paths of msys2)

    You will have to restart any consoles, including vscode, to inherit and reflect your changed path in your development environment of vscode.

    important:

    If you have many entrances in your Path, make sure your ucrt-path is not too far at the end. I’m not the only and last one that got all sorts of trouble whith msys2 in vscode because of this.
    See here: Setting up vscode with msys2 clang

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search