首页 > 编程语言 > 详细

wsl下使用vscode对C++进行断点调试

时间:2020-06-11 19:07:53      阅读:159      评论:0      收藏:0      [点我收藏+]

首先

在vscode下给wsl安装C/C++插件,注意不是LOCAL
技术分享图片

其次

打开wsl remote terminal并安装gdb
速度过慢参考wsl安装Ubuntu16.04+Python2.7换源

$ sudo apt install gdb

最后

在cpp文件目录下创建.vscode/launch.json并写入以下内容:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++ - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++ build active file",
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

齐活

可以正常debug并进入断点调试
技术分享图片

wsl下使用vscode对C++进行断点调试

原文:https://www.cnblogs.com/azureology/p/13095148.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!