vscode debug C++无法输入问题

研究了半天vscode debug c++无法输入的问题,原来vscode的文档里面已经记录了。issue都是2020年提的了,还没解决。。。 不过人家也确实给了一个解法:用外部的terminal。 不过怎么看都还不是很方便,所以还是推荐直接使用CodeLLDB插件来进行debug吧

  1. 安装CodeLLDB
  2. 打开.vscode下的launch.json, 点击右下角的Add Configuration,添加CodeLLDB:Launch, 把program 改成对应的${fileDirname}/${fileBasenameNoExtension}, 同时添加preLaunchTask 指向 task.json 中的build任务

使用CodeLLDB的过程发现用指针不显示字符串,参考这篇文章改成native即可。

launch.json

json 复制代码
            {
                "type": "lldb",
                "request": "launch",
                "name": "Launch",
                "program": "${fileDirname}/${fileBasenameNoExtension}",
                "args": [],
                "cwd": "${workspaceFolder}",
                "preLaunchTask": "Build active file"
            }

task.json

json 复制代码
 {
            "type": "cppbuild",
            "label": "Build active file",
            "command": "/usr/bin/clang++",
            "args": [
                "-fcolor-diagnostics",
                "-fansi-escape-codes",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        },

Terminal won't launch for input

相关推荐
hold?fish:palm5 分钟前
从源码到可执行文件:C++程序的编译过程
开发语言·c++
lingran__30 分钟前
C++_STL简介
开发语言·c++
南国韭菜40 分钟前
【无标题】
c++·qt
没用的阿_吉1 小时前
vs2022offline 生成
c++
qq_416409132 小时前
专业的openclaw推荐
c++
一个小猴子`3 小时前
CUDA全局内存
c++·cuda编程
ysa0510303 小时前
【板子】树上启发式合并
数据结构·c++·笔记·算法
Simple_core4 小时前
cmake模板和问题总结
c++
学无止境_永不停歇4 小时前
十五、智能指针
开发语言·c++
郝学胜-神的一滴5 小时前
Qt 高级编程 035:无边框窗口+自定义标题栏 完整实现详解
开发语言·c++·qt·程序人生·用户界面