我正在尝试实时调试一个 C 程序,该程序使用 VScode 的 C/C++ 扩展,还允许我使用 scanf() 将直接输入写入控制台。但是,当我调试代码时,它会打开调试控制台,该控制台不允许我输入任何输入。
我发现人们回答了这个问题的两个线程:
https://github.com/OmniSharp/omnisharp-vscode/issues/1053
调试控制台窗口在调试期间无法接受 Console.ReadLine() 输入
两者都建议将 launch.json 文件中的“console”属性设置为“externalTerminal”或“integratedTerminal”。然而,我无法找到该属性或创建它,因为它不存在于我的文件中。
我确实有“externalConsole”属性,可以将其设置为 true 或 false。但这两个选项似乎都像以前一样打开调试控制台。
launch.json 文件:
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/mnt/c/Users/David/Documents/code/puc-rio/inf1010/lab8/teste.out",
"args": [],
"stopAtEntry": true,
"cwd": "/mnt/c/Users/David/Documents/code/puc-rio/inf1010/lab8/",
"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\\sysnative\\bash.exe",
"pipeArgs": [
"-c"
],
"debuggerPath": "/usr/bin/gdb"
},
"sourceFileMap": {
"/mnt/c": …Run Code Online (Sandbox Code Playgroud)