• VSCODE 针对调试C语言时一闪而过解决办法


    针对调试C语言时一闪而过解决办法

    前提:

    已经按照 C/C++

    已经安装 MINGW(并配置完成)

    原因:

     主要是因为tasks的配置没有写对

    解决办法:

    tasks.json

    {
        // See https://go.microsoft.com/fwlink/?LinkId=733558
        // for the documentation about the tasks.json format
        "version": "2.0.0",
        "command": "gcc",
        //gcc 编译条件
        //gcc gdb-sample.c -o gdb-sample -g
        "args": [
            "${file}",
            "-o",
            "${fileDirname}/${fileBasenameNoExtension}",
            "-g",
        ],
    }

    最主要的就是args这个参数了

    配合GCC编译调试条件填写即可

    gcc gdb-sample.c -o gdb-sample -g

    gcc="command": "gcc"

    gdb-sample.c=源文件 也就是 "${file}"

    -o=编译条件

    gdb-sample="生成文件",可以写成"${fileDirname}/${fileBasenameNoExtension}",

    -g=调试条件

    Launch.json

    {
        // 使用 IntelliSense 了解相关属性。 
        // 悬停以查看现有属性的描述。
        // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "name": "(gdb) Launch",
                "type": "cppdbg",
                "request": "launch",
                "targetArchitecture": "x64",
                "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
                "args": [],
                "stopAtEntry": false,
                "cwd": "${workspaceFolder}",
                "environment": [],
                "externalConsole": false,
                "MIMode": "gdb",
                "miDebuggerPath": "C:\MinGW\bin\gdb.exe",
                "setupCommands": [
                    {
                        "description": "Enable pretty-printing for gdb",
                        "text": "-enable-pretty-printing",
                        "ignoreFailures": true
                    }
                ],
                "preLaunchTask": "gcc"
            }
        ]
    }

     launch最主要就是两个

    miDebugggerPath=这个是gdb所在的位置,仔细填写即可

    program=这个则是调试可运行程序所在的位置。

    对于具体的vscode的条件编写可以参考https://code.visualstudio.com/docs/editor/variables-reference【可配合谷歌浏览器实时翻译】

  • 相关阅读:
    MATLAB矩阵操作【z】
    matlab绘图方法[z]
    Drawhere 有趣的网页涂鸦工具【z】
    DemoHelper,针对电脑演示的小工具
    Matlab Matrix [z]
    MATLAB函数参考[z]
    计算几何常用算法概览[z]
    matlab命令行环境的常用操作[z]
    不常见数学符号或简写
    matlab加入上级路径和本级路径的方法
  • 原文地址:https://www.cnblogs.com/T-ARF/p/9766142.html
Copyright © 2020-2023  润新知