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

相关推荐
黎相思2 小时前
LRU Cache
c++·缓存
UIU1142 小时前
P1003 [NOIP 2011 提高组] 铺地毯
数据结构·c++·算法
golang学习记2 小时前
最新版VS Code开发Spring Boot项目保姆级教程
java·spring boot·vscode·后端
xxwl5853 小时前
区域赛算法模版第四章---数据结构
数据结构·c++·算法
余额瞒着我当琳5 小时前
哈希表底层原理解析,直接定址法,哈希冲突,负载因子,哈希函数,开放定址法
java·c++·哈希算法·散列表
xxwl5855 小时前
区域赛算法模版第五章---数学与数论
c++·笔记·算法
局部有解6 小时前
LeetCode Hot100 438 找到字符串中所有字母异位词
c++·算法·leetcode
David猪大卫6 小时前
【C++修炼】string类:string类的模拟实现
c语言·开发语言·数据结构·c++·经验分享·笔记·学习
WL学习笔记7 小时前
模板初阶(C++)
开发语言·c++·后端·模板初阶
埃伊蟹黄面7 小时前
面试常问题目 —— STL
c++·面试·职场和发展·stl