2024年物联网嵌入式最新【VSCode】Windows下VSCode编译调试c c++【更新 2018,看完这一篇你就懂了

收集整理了一份《2024年最新物联网嵌入式全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升的朋友。
img
img

如果你需要这些资料,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人

都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

————————– 2018.03.27 更新————————-
便携版已更新,点此获取便携版
已知BUG:中文目录无法正常调试
用于cpptools 0.15.0插件的配置文件更新
新的launch.json

// 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": "C:/Program Files (x86)/MinGW/bin/gdb.exe", // GDB的路径,注意替换成自己的路径
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }]
}

新的tasks.json

// 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\""
                ]
            }
        }
    ]
}

懒得自己配置或自己配置出现不明问题的朋友可以点这里:
【VSCode】Windows下VSCode便携式c/c++环境
http://blog.csdn.net/c_duoduo/article/details/52083494
下载解压即可食用。

————————– 2017.06.10 更新 (已过时)————————-

便携版已更新,点此获取便携版
用于cpptools插件的配置文件更新
更新的launch.json

// 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": "C++ Launch (GDB)", // 配置名称,将会在启动配置的下拉菜单中显示
        "type": "cppdbg", // 配置类型,这里只能为cppdbg
        "request": "launch", // 请求配置类型,可以为launch(启动)或attach(附加)
        "targetArchitecture": "x86", // 生成目标架构,一般为x86或x64,可以为x86, arm, arm64, mips, x64, amd64, x86\_64
        "program": "${file}.exe", // 将要进行调试的程序的路径

        "miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe", // miDebugger的路径,注意这里要与MinGw的路径对应

        "args": [], // 程序调试时传递给程序的命令行参数,一般设为空即可
        "stopAtEntry": false, // 设为true时程序将暂停在程序入口处,一般设置为false
        "cwd": "${fileDirname}", // 调试程序时的工作目录,一般为${workspaceRoot}即代码所在目录
        "externalConsole": true, // 调试时是否显示控制台窗口,一般设置为true显示控制台
        "preLaunchTask": "g++"   // 调试会话开始前执行的任务,一般为编译程序,c++为g++, c为gcc
    }]
}

更新的tasks.json

{
    "version": "0.1.0",
    "command": "g++",
    "args": ["-g","${file}","-o","${file}.exe"],    // 编译命令参数
    "problemMatcher": {
        "owner": "cpp",
        "fileLocation": ["relative", "${workspaceRoot}"],
        "pattern": {
            "regexp": "^(.\*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.\*)$",
            "file": 1,
            "line": 2,
            "column": 3,
            "severity": 4,
            "message": 5
        }
    }
}

懒得自己配置或自己配置出现不明问题的朋友可以点这里:
【VSCode】Windows下VSCode便携式c/c++环境
http://blog.csdn.net/c_duoduo/article/details/52083494
下载解压即可食用。

————————– 以下是原文 ————————-

这篇文章为blackkitty记录在windows下使用vscode编译调试c/c++的详细过程

首先看效果
设置断点,变量监视,调用堆栈的查看
设置断点,变量监视,调用堆栈的查看

条件断点的使用:
条件断点的使用

下面是配置过程:

总体流程:

  1. 下载安装vscode
  2. 安装cpptools插件
  3. 安装编译、调试环境
  4. 修改vscode调试配置文件
  5. 完了

下载安装vscode
https://code.visualstudio.com/Download
这里写图片描述
点击下载自己喜欢的相应版本,绿色版解压即可食用

安装cpptools插件
打开vscode,按ctrl+e打开快速命令框,输入以下命令后等待

img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上物联网嵌入式知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、电子书籍、讲解视频,并且后续会持续更新

如果你需要这些资料,可以戳这里获取

61779188)]

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上物联网嵌入式知识点,真正体系化!

由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、电子书籍、讲解视频,并且后续会持续更新

如果你需要这些资料,可以戳这里获取

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值