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"
        },
       
       
    ]
}
相关推荐
来鸟 鸣间7 小时前
vscode 连接远程服务器
服务器·ide·vscode
zhlei_123457 小时前
封闭内网安装配置VSCode Anconda3 并配置 PyQt5开发
ide·vscode·pyqt
m0_749317527 小时前
vscode里如何用git
ide·git·vscode
waterHBO15 小时前
一个小小的 flask app, 几个小工具,拼凑一下
javascript·vscode·python·flask·web app·agent mode·vibe coding
伍六星17 小时前
更新Java的环境变量后VScode/cursor里面还是之前的环境变量
java·开发语言·vscode
阿諪諪1 天前
在VSCode中开发一个uni-app项目
ide·vscode·uni-app
waterHBO1 天前
修改 vscode 左侧导航栏的文字大小 (更新版)
ide·chrome·vscode·编辑器
行走的生活1 天前
vscode中无法使用npm node
ide·vscode·npm
程序猿小D1 天前
第12节 Node.js 函数
开发语言·ide·人工智能·vscode·node.js·c#·编辑器
猫头虎1 天前
零基础安装 Python 教程:从下载到环境配置一步到位(支持 VSCode 和 PyCharm)与常用操作系统操作指南
vscode·python·pycharm·beautifulsoup·numpy·pyqt·pip