如何在 VsCode 上调试 C++/C 程序

How to debug C++/C programs on VsCode

我正在使用 gcc/g++ 编译器,将 msys64 和 mingw64 与 VsCode 结合使用。我已将 mingw64 的 bash.exe 附加到我的 VsCode 终端。我可以使用 g++ file_name.cpp && ./a.exe 在 bash 终端上 运行 我的程序。 但是我该如何调试我的程序呢?

实际上 VScode 中的调试有点棘手。你按照这里的方法做了吗-

https://code.visualstudio.com/docs/cpp/cpp-debug