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

相关推荐
旖旎夜光8 小时前
多态(11)(下)
c++·学习
yangpipi-8 小时前
《C++并发编程实战》 第4章 并发操作的同步
开发语言·c++
Chance_to_win8 小时前
C++基础知识
c++
有趣的我8 小时前
C++ 多态介绍
开发语言·c++
WBluuue9 小时前
Codeforces 1068 Div2(ABCD)
c++·算法
阿沁QWQ10 小时前
C++的map和set
开发语言·c++
HarrySunCn11 小时前
如何使用VSCode开发Arduino项目
ide·vscode·单片机·编辑器
charlie11451419111 小时前
现代C++工程实践:简单的IniParser3——改进我们的split
开发语言·c++·笔记·学习
fish_xk11 小时前
c++的引用和类的初见
开发语言·c++
晨尘光12 小时前
【Windows 下FlatBuffers 编译.fbs文件并应用】
c++·windows