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

相关推荐
liulilittle2 小时前
FileStream C++
开发语言·c++·cocoa
Gomiko2 小时前
C/C++基础(五):分支
c语言·c++
点PY2 小时前
C++ 中 std::async 和 std::future 的并发性
java·开发语言·c++
不会代码的小猴2 小时前
C++的第九天笔记
开发语言·c++·笔记
银迢迢3 小时前
idea控制台中文乱码采用好几种方法一直解决不了
java·ide·intellij-idea
fqbqrr3 小时前
2512C++,clangd支持模块
开发语言·c++
好好沉淀4 小时前
IDEA 取消 Save Actions 自动删除未用导入(前端开发避坑)
java·ide·intellij-idea
老王熬夜敲代码4 小时前
C++中的thread
c++·笔记·面试
qq_479875435 小时前
C++ 鸭子类型” (Duck Typing)
开发语言·c++
崇山峻岭之间5 小时前
C++ Prime Plus 学习笔记033
c++·笔记·学习