[英]C/C++ Debugger does not work in VSC despite correct config
If I try to run a debugging session on Visual Studio Code with C++ I get this error .如果我尝试使用 C++ 在 Visual Studio Code 上运行调试 session,我会收到此错误。
This is my config, I want the debugging session to launch in the VSC terminal using WSL.这是我的配置,我希望调试 session 使用 WSL 在 VSC 终端中启动。
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb", //here :(
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
G++ and GDB are both installed locally and WSL .I tried using all these directories for the "miDebuggerPath" path; G++ 和 GDB 都安装在本地和WSL中。我尝试将所有这些目录用于“miDebuggerPath”路径; did not work.不工作。
You need to change the miDebuggerPath to the path where gdb is installed in your WSL-environment.您需要将 miDebuggerPath 更改为 WSL 环境中安装 gdb 的路径。
So you have to set miDebuggerPath to:因此,您必须将 miDebuggerPath 设置为:
"miDebuggerPath": "/usr/share/gdb",
when you wanto to run gd in a WSL-Environment.当你想在 WSL 环境中运行 gd 时。 Change it to将其更改为
"miDebuggerPath": "C:/MinGW/bin/gdb.exe",
when you want to debug in Windows.当你想在 Windows 中调试时。
Install C/C++ extension on WSL Remote Subsystem even if you have it locally installed.即使您在本地安装了 C/C++ 扩展,也可以在 WSL 远程子系统上安装它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.