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

相关推荐
Tian_Hang15 小时前
Factory Method | 工厂方法
开发语言·c++
小poop15 小时前
VS实用调试技巧详解
vscode
π同学15 小时前
ESP-IDF+vscode开发ESP32第十五讲——队列、流缓冲区、环形缓冲区
vscode·esp32·缓冲区
anthonyzhu15 小时前
安卓Android studio panda run无法应用更新的问题
android·ide·android studio
elseif12315 小时前
【C++】vector 详细版
开发语言·c++·算法
寂夜了无痕16 小时前
IntelliJ IDEA 高效配置:新建文件自动生成作者与时间注释
java·ide·intellij-idea
cany100016 小时前
C++ -- 原子变量
c++
golang学习记16 小时前
Intellij IDEA 2026重磅更新!开发体验大升级
java·ide·intellij-idea
cany100016 小时前
C++ -- 队列std::queue
开发语言·c++
周末也要写八哥17 小时前
C++中单线程方式之无脑上锁
java·开发语言·c++