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

相关推荐
cooldream20097 小时前
当代 C++ 的三大技术支柱:资源管理、泛型编程与模块化体系的成熟演进
开发语言·c++
Queenie_Charlie7 小时前
数字去重(set)
数据结构·c++·set
Ayanami_Reii8 小时前
区间不同数的个数-树状数组/线段树/莫队/主席树
数据结构·c++·算法·线段树·树状数组·主席树·莫队
大筒木老辈子8 小时前
C++笔记---并发支持库(atomic)
java·c++·笔记
zero_hz8 小时前
核心区分:用户态/内核态切换 vs. 程序阻塞
c++·io·内核态用户态
胡萝卜3.08 小时前
深入C++可调用对象:从function包装到bind参数适配的技术实现
开发语言·c++·人工智能·机器学习·bind·function·包装器
看见繁华9 小时前
C++ 高级
开发语言·c++
点云SLAM9 小时前
constexpr 和 explicit 在 C++ 中被提出的动机
开发语言·c++·explicit关键字·隐式转换·constexpr关键字·c++11/17/20
冷崖9 小时前
工厂模式-创建型
c++·设计模式
qq_310658519 小时前
mediasoup源码走读(六)——NetEQ
服务器·c++·音视频