【发布时间】:2019-10-05 22:36:00
【问题描述】:
我正在学习 Visual Studio Code C/C++ 调试工具,我正在按照教程 here 以及何时开始调试。我收到了这个错误。
我在 Ubuntu 上运行 WSL/Bash,并在 WSL 上安装了 gcc/g++ 和 gdb。
这是我在 launch.json 中的代码。非常感谢您的帮助。
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/mnt/c/Users/myusername/Projects/CPP/helloworld/helloworld.out",
"args": [""],
"stopAtEntry": true,
"cwd": "/mnt/c/Users/myusername/Projects/CPP/helloworld/",
"environment": [],
"externalConsole": true,
"windows": {
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
"pipeTransport": {
"pipeCwd": "",
"pipeProgram": "C:\\Windows\\System32\\bash.exe",
"pipeArgs": ["-c"],
"debuggerPath": "/usr/bin/gdb"
},
"sourceFileMap": {
"/mnt/c": "C:\\",
"/usr": "C:\\Users\\myusername\\AppData\\Local\\Packages\\CanonicalGroupLimited.UbuntuonWindows79rhkp1fndgsc\\LocalState\\rootfs\\usr\\"
}
}
]
}
【问题讨论】:
-
WSL 中的
>> ls /usr/bin/gdb是否显示文件存在? -
是的,我刚刚访问了 WSL,输入了 cd usr、cd bin 和 ls gdb,它显示 gdb 确实存在
标签: c++ c bash visual-studio-code windows-subsystem-for-linux