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

相关推荐
炘爚6 分钟前
C++实现分布式集群聊天服务器
服务器·c++·分布式
低频电磁之道15 分钟前
C++中 explicit 用法:多参数构造函数
c++
czxyvX1 小时前
2-Qt信号与槽
c++·qt
hjuan___1 小时前
给 Claude Code 装上“技能库”和“眼睛”:配置 Skills 与图片识别实战
vscode·minimax·mcp·ai 编程·claude code·cc switch
样例过了就是过了1 小时前
LeetCode热题100 杨辉三角
c++·算法·leetcode·动态规划
历程里程碑1 小时前
MySQL视图:虚拟表的实战技巧
java·开发语言·数据库·c++·sql·mysql·adb
啊我不会诶1 小时前
Educational Codeforces Round 120 (Rated for Div. 2) vp补题
c++·算法
埃伊蟹黄面1 小时前
C++ —— 智能指针
开发语言·c++·算法
大肥羊学校懒羊羊2 小时前
质因数个数问题:高效分解算法详解
开发语言·c++·算法
❀͜͡傀儡师2 小时前
GitHub Copilot for VS Code 中文使用完整教程
vscode·github·copilot