我正在尝试使用 WSL Ubuntu 设置 VS 代码来运行 C++ 代码。我已经安装了 gdb 和 g++,并且能够使用 Ubuntu 和 VS code 终端运行代码。但是,当我尝试在 VS code 中调试代码时,我在终端中收到以下错误。
&"warning: GDB: Failed to set controlling terminal: Operation not permitted\\n"
\[1\] + Done "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0\<"/tmp/Microsoft-MIEngine-In-pyvj15od.ucf" 1\>"/tmp/Microsoft-MIEngine-Out-sl4nyggt.r1b"
在调试控制台中,我收到以下错误,
ERROR: Unable to start debugging. Unexpected GDB output from command "-exec-run". Warning:
Cannot insert breakpoint 1.
Cannot access memory at address 0x8001189
Cannot insert breakpoint 2.
Cannot access memory at address 0x8001191
有人可以帮我解决这个问题吗?预先感谢。
这是tasks.json 文件。
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++-11 build active file",
"command": "/usr/bin/g++-11",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
未生成 launch.json 和 settings.json 文件。