我在 ubuntu 上用 Visual Studio 代码创建了一个 C++ 项目。它使用 gdb 模式启动程序,但在输出中不显示任何内容。当我从控制台启动程序时,输出存在。我尝试插入“控制台”属性,但 vscode 告诉我,它是被禁止的(来自节点https://github.com/Microsoft/vscode/issues/30842 的类似问题)。
如何启用 vscode 来显示我的程序的输出?
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)