VSCode 的 C/C++ 调试环境的 launch.json、 tasks.json 文件

2023-05-16

launch.json

// Configuring tasks.json for C/C++ debugging
// author: huihut
// repo: https://gist.github.com/huihut/9548fe7e1084cf8e844120c5668b8177

// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team        
// ${file}: the current opened file                     
// ${fileBasename}: the current opened file's basename 
// ${fileDirname}: the current opened file's dirname    
// ${fileExtname}: the current opened file's extension  
// ${cwd}: the current working directory of the spawned process

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "preLaunchTask": "build",
            "type": "cppdbg",
            "request": "launch",
            "program": "${fileDirname}/${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }]
}

tasks.json

// Configuring tasks.json for C/C++ debugging 
// author: huihut
// repo: https://gist.github.com/huihut/887d3c28db92617bd5148c20a5ff112a

// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team        
// ${file}: the current opened file                     
// ${fileBasename}: the current opened file's basename 
// ${fileDirname}: the current opened file's dirname    
// ${fileExtname}: the current opened file's extension  
// ${cwd}: the current working directory of the spawned process


{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": false,
                "panel": "shared"
            },
            "windows": {
                "command": "g++",
                "args": [
                    "-ggdb",
                    "\"${file}\"",
                    "--std=c++11",
                    "-o",
                    "\"${fileDirname}\\${fileBasenameNoExtension}.exe\""
                ]
            }
        }
    ]
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

VSCode 的 C/C++ 调试环境的 launch.json、 tasks.json 文件 的相关文章

随机推荐

  • Aruco的使用+opencv+opencv_contrib+cmake

    Aruco的使用 By GuangyeHu 1 下载 xff1a https sourceforge net projects aruco files 解压到相应的文件夹 2 安装Cmake 本次实现使用的是cmake 3 15 1 win
  • Nginx 配置多个Vue项目

    背景 xff1a 公司要求将之前用不同端口号区分的三个独立的系统统一配置到统一域名下 VUE项目配置 示例 xff1a 有两个项目 第一个 xff1a 打包到 96 test1 96 目录中 xff1b 第二个 xff1a 打包到 96 t
  • AD随堂笔记

    算起来 xff0c 这次算是第四次打板子了 xff0c 还是出现了不可饶恕的错误 串口三的TXD RXD接反了 xff0c 还有一根线是短路的 造成的原因 xff0c 就是没有进行规则检查 因为这个板子是在原来基础上面改的 xff0c 大意
  • 学习Linux必备书籍推荐

    xfeff xfeff 鸟哥的私房菜 xff08 第3版 xff09 xff0c 鸟哥著 xff1a 这本书内容丰富全面 xff0c 基本概念的讲解非常细致 xff0c 深入浅出 xff0c 各种功能和命令的介绍都配以大量的实例操作和详尽的
  • 无人机目标检测 Darknet-ROS 学习(一)

    无人机目标检测 Darknet ROS 学习 xff08 一 xff09 简介 在无人机上实现目标检测 xff0c 使用的设备是阿木实验室P200 xff0c 飞控是PX4 xff0c 板载计算机是TX2 xff0c 目的是在无人机有限的计
  • Android - Service

    前台20s后台200s不执行玩就报ANR异常 一 概念 没有界面在后台长期运行在主线程中的一个组件 ServiceThread可以配置执行在不同的进程中 CPU调度的最小单位 任何有Context的地方都可以控制Service当Activi
  • 2022年打工人转行实录!你后悔转行了吗?

    2022年 xff0c 有许多年轻人在寻求 转行 根据 2022Q1中高端人才就业趋势大数据报告 xff0c 今年一季度有55 87 的职场人有跳槽计划 xff0c 而这之中 xff0c 有65 34 的职场人选择跨行业跳槽 在各种社交平台
  • 2.PendSV的触发

    PendSV典型使用场合是在上下文切换时 xff08 在不同任务之间切换 xff09 我们先简单的写几段代码实现PendSV的中断触发 xff0c 当然也会涉及到CM3内核汇编指令 xff0c 自从开始挑战的那天起 xff0c 你不如地狱谁
  • C语言: 字符串结束符 ‘ \0 ’

    1 本质 39 0 39 是字符串结束标志 xff0c 不计入串长 xff0c 但要占内存空间 39 0 39 是一个ASCII控制字符 xff0c 是转义字符 意思是告诉编译器 xff0c 这不是字符0 xff0c 而是空字符 空字符 0
  • Docker中容器的备份、恢复和迁移

    转自 xff1a http www linuxidc com Linux 2015 08 121184 htm 1 备份容器 首先 xff0c 为了备份Docker中的容器 xff0c 我们会想看看我们想要备份的容器列表 要达成该目的 xf
  • Ubuntu 安装 clang++

    clang 安装
  • 对vector使用指针

    include lt stdio h gt include lt iostream gt include lt vector gt using namespace std int main vector lt int gt a b c fo
  • 单片机初学者电路常识

    电路常识性概念 xff08 1 xff09 输入 输出阻抗 1 输入阻抗 输入阻抗是指一个电路输入端的等效阻抗 在输入端上加上一个电压源U xff0c 测量输入端的电流I xff0c 则输入阻抗Rin 61 U I 你可以把输入端想象成一个
  • 使用 FreeRTOS 时使用 GPIO 监控 CPU 负载的正确方法?

    总目录链接 61 61 gt gt AutoSAR入门和实战系列总目录 总目录链接 61 61 gt gt AutoSAR BSW高阶配置系列总目录 文章目录 我想切换一些 GPIO 以监控 CPU 活动和 FreeRTOS 上下文 更具体
  • iTerm2 + OhMyZsh + agnoster + Powerline + solarized = 漂亮的Mac终端

    唠叨一下 自从装了黑苹果后一直用着 Mac 自带的终端 xff08 Terminal xff09 xff0c 相比 Windows 的终端根本无法同台竞技 xff01 毕竟 Mac 是基于 Unix 嘛 对开发友好太多了 就是下面这个家伙了
  • CloudCompare功能概要

    File open xff1a 打开save xff1a 保存Global Shift settings xff1a 设置最大绝对坐标 xff0c 最大实体对角线Primitive Factory xff1a 对点云进行原始加工 xff0c
  • 机会总是留给有准备的人 —— 从裁缝到码农

    序言 2014年8月 xff0c 一个男生拿着广工服装工程专业的录取通知书来到东风路 xff0c 望着学校大门 xff0c 想着 xff1a 这就是我的大学 xff1f 2014年11月 xff0c 一个男生一个女生望着广工大学城的大门 x
  • Launcher 启动 UE4 引擎出现 An Unreal process has crashed 的问题

    Launcher 启动 UE4 引擎出现 An Unreal process has crashed 的问题 问题描述 在 Launcher 启动 UE4 引擎 xff0c 引擎奔溃 xff0c 出现奔溃报告 xff1a An Unreal
  • 使用MFC的CDC类绘制三维坐标系及球面函数

    系列链接 使用MFC的CDC类绘制二维坐标系及正余弦函数 源码 使用MFC的CDC类绘制三维坐标系及球面函数 源码 概述 本文使用MFC的CDC类绘制三维坐标系及球面函数 首先计算推导出三维坐标在二维平面显示的坐标变换方程 xff08 使用
  • VSCode 的 C/C++ 调试环境的 launch.json、 tasks.json 文件

    launch json span class hljs comment Configuring tasks json for C C 43 43 debugging span span class hljs comment author h