Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ Why is MSYS2 MINGW UCRT x64 gdb command not found

Tags:

c++

msys

msys2

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:\msys64\mingw64\bin 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:\msys64\mingw64\bin 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

like image 310
IronMan829 Avatar asked Oct 25 '25 06:10

IronMan829


1 Answers

$ 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:\msys64\ucrt64\bin

instead of C:\msys64\mingw64\bin(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

like image 198
maddes8cht Avatar answered Oct 26 '25 20:10

maddes8cht



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!