Vscode根据Makefile文件使用make编译程序配置文件launch.json,task.json

视频介绍:

VsCode使用make编译程序配置_哔哩哔哩_bilibili

task.json: 2024年4.20

ctrl shift b 编译

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "build_suricata",
        "type": "shell",
        "command": "make && sudo make install",  //suricata编译
        "problemMatcher": [
            "$gcc"

        ],
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "presentation": {
            "echo": true,
            "reveal": "always",
            "focus": false,
            "panel": "dedicated",
            "showReuseMessage": false,
            "clear": true
        }
      },


      {
        "type": "shell",  //或者是process 区别找文档
        "label": "C/C++: g++ build active file", //任务标签
        "command": "/usr/bin/g++",
        "args": [
            "-g",
            "-Wall",
            "-std=c++17",
            "${fileDirname}/*.cpp",
            "-o",
            "${fileDirname}/${fileBasenameNoExtension}"
        ],
        "detail": "compiler: /usr/bin/g++",
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "presentation": {
            "echo": true,
            "reveal": "always", //是否将集成终端面板置于前面
            "focus": true, //是否获得焦点
            "panel": "dedicated",
            "showReuseMessage": false, //控制是否显示"终端将被任务重用,按任意键关闭它"消息
            "clear": true // 运行前清除终端
        },
        "problemMatcher": [
            "$gcc"
        ]
      },
      
        
    ],
    "options": {
        "shell": {
            "executable": "/bin/bash",
            "args": [
                "-c"
            ]
        },
        "env": {
            "PATH": "/usr/bin:${env:PATH}"
        }
    }
}


//官方文档:https://code.visualstudio.com/docs/editor/tasks

launch.json: 2024年 4.20

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "cppdbg",
            "request": "launch",
            "name": "DeBug_suricata",
            // "program": "${workspaceFolder}/src/suricata",
            "program": "/usr/local/bin/suricata",
            "args": [
                "-i",
                "ens33",
                "-c",
                "/etc/suricata/suricata.yaml",
                "-v",
                "--runmode",
                "single",
                "-l",
                "/home/daxian/Desktop/zs/suricata-log-dir/"

            ],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "/usr/bin/gdb",
            // "preLaunchTask": "build_suricata"
        },





        
        {
            "name": "g++ - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "miDebuggerPath": "/usr/bin/gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "C/C++: g++ build active file"
        },
       
       
    ]
}
相关推荐
真·Wild·攻城狮34 分钟前
【码农日常】Vscode Clangd初始化失败(Win10)
ide·vscode·编辑器
小堇不是码农35 分钟前
在VScode中配置C_C++环境
c语言·c++·vscode
七灵微35 分钟前
【测试】【Debug】vscode中同一个测试用例出现重复
ide·vscode·编辑器
哇咔咔哇咔14 小时前
使用Markdown编写适用于GitHub的README.md文件的目录结构
vscode·markdown
羊小猪~~19 小时前
神经网络基础--什么是神经网络?? 常用激活函数是什么???
人工智能·vscode·深度学习·神经网络·机器学习
Eiceblue20 小时前
Python 在PDF中绘制形状(线条、矩形、椭圆形等)
vscode·python·pycharm·pdf
tekin1 天前
vscode php Launch built-in server and debug, PHP内置服务xdebug调试,自定义启动参数配置使用示例
ide·vscode·php·launch.json·runtimeargs·php内置服务自定义参数
曹申阳1 天前
vscode 创建 vue 项目时,配置文件为什么收缩到一起展示了?
ide·vue.js·vscode
丶Darling.2 天前
vscode在windows和linux如何使用cmake构建项目并make生成可执行文件,两者有什么区别
linux·windows·vscode
羊小猪~~2 天前
前端入门一之CSS知识详解
前端·javascript·css·vscode·前端框架·html·javas