【问题标题】:VSCode debugging C++ launches external terminal, but doesn't run programVSCode调试C++启动外部终端,但不运行程序
【发布时间】: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


    【解决方案1】:

    我也有同样的问题。这可能不是有效的答案,但希望它能让我们在正确的道路上走得更远。

    我做了一些挖掘,发现了以下内容:

    • VS 代码文档mentioned 它通过 lldb-mi 打开一个外部控制台。
    • 在 Apple 开发者论坛上搜索 lldb-mi 后转到 this post
    • ...导致开源Github Repo 带有 lldb-mi 的构建

    我需要先通读该版本的文档,然后再试一试。如果解决了问题,我会发布结果。

    【讨论】:

    猜你喜欢
    • 2021-07-09
    • 2018-07-31
    • 2012-11-14
    • 2021-02-17
    • 2022-01-02
    • 2021-01-07
    • 1970-01-01
    • 1970-01-01
    • 2021-12-01
    相关资源
    最近更新 更多