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

相关推荐
ZouZou老师5 小时前
C++设计模式之装饰器模式:以家具生产为例
c++·设计模式·装饰器模式
ZouZou老师5 小时前
C++设计模式之桥接模式:以家具生产为例
c++·设计模式·桥接模式
呱呱巨基5 小时前
Linux 进程概念
linux·c++·笔记·学习
liulilittle5 小时前
C++ 浮点数封装。
linux·服务器·开发语言·前端·网络·数据库·c++
ZouZou老师5 小时前
C++设计模式之组合模式:以家具生产为例
c++·设计模式·组合模式
yong15858553436 小时前
2. Linux C++ muduo 库学习——原子变量操作头文件
linux·c++·学习
小小8程序员6 小时前
STL 库(C++ Standard Template Library)全面介绍
java·开发语言·c++
飞Link6 小时前
Windows 环境下 LaTeX 的安装配置教程
windows·vscode
老王熬夜敲代码7 小时前
C++中的atomic
开发语言·c++·笔记·面试
龚礼鹏8 小时前
Android应用程序 c/c++ 崩溃排查流程
c语言·开发语言·c++