【发布时间】:2020-07-11 18:30:26
【问题描述】:
我已经设置了一个 launch.json 文件,以便 C++ 程序使用外部控制台(以便它可以接收用户输入),但是在启动时,VSCode 只是打开一个终端窗口而不在其中运行程序。如果"externalConsole": true, 设置为false,程序运行并且可以正常调试,只是不能接受输入。
注意:没有使用 task.json 文件,CMake 用于创建可执行二进制文件。
启动文件:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "g++ - Debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/program_bin",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build/bin",
"environment": [],
"MIMode": "lldb",
"externalConsole": true,
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true,
}
]
}
]
}
VSCode 是否可能没有运行外部终端的“权限”?在 MacOS 上使用。
【问题讨论】:
标签: macos debugging visual-studio-code vscode-debugger