vscode不能命中断点如何解决


本文摘自PHP中文网,作者藏色散人,侵删。

vscode不能命中断点如何解决

vscode c++ 编译生成后,调试时无法命中断点的解决办法

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

//test.cpp

#include <stdio.h>

int g_var = 0;

void print_line(char *str)

{

    if (str != NULL)

        printf("%s\r\n", str);

    else

        printf("null string\r\n");

}

int main (int argc, char **argv)

{

    int l_var = 1;

    print_line("hello world!");

    printf("g_var = %d, l_var = %d.\r\n", g_var, l_var);

    return 0;

}

launch.json

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

{

        "version": "0.2.0",

        "configurations": [

            {

                "name": "(gdb) Launch",

                "type": "cppdbg",

                "request": "launch",

                "program": "${workspaceRoot}/test.exe",

                "args": [],

                "stopAtEntry": false,

                "cwd": "${workspaceRoot}",

                "environment": [],

                "externalConsole": true,

                "MIMode": "gdb",

                "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",

                "setupCommands": [

                    {

                        "description": "Enable pretty-printing for gdb",

                        "text": "-enable-pretty-printing",

                        "ignoreFailures": true

                    }

                ]

            }

        ]

    }

tasks.json

1

2

3

4

5

6

7

8

9

10

11

12

13

{

    // See https://go.microsoft.com/fwlink/?LinkId=733558

    // for the documentation about the tasks.json format

    "version": "2.0.0",

    "tasks": [

        {

            "taskName": "test",

            "type": "shell",

            "command": "g++",

            "args": ["-g", "${file}", "-o", "${workspaceRoot}/test.exe"]

        }

    ]

}

编译成功后,在源码中设置断点,却无法命中断点。

阅读剩余部分

相关阅读 >>

怎么查看vsCode编码方式

vsCode没有语法提示的解决方法

vsCode如何运行java文件

vsCode中js文件字体显示白色

分享13个实用vsCode插件,让你写代码不再头疼!!

vsCode tab相当于几个空格

vsCode怎么创建css文件

vsCode用户设置在哪里打开

vsCode能做哪些编程

vsCode可以开发什么

更多相关阅读请进入《vsCode》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...