码迷,mamicode.com
首页 > 编程语言 > 详细

vscode下搭建C/C++环境

时间:2020-01-31 12:37:28      阅读:94      评论:0      收藏:0      [点我收藏+]

标签:tar   ignore   ext   ref   load   build   als   blog   log   

vscode下搭建C/C++环境

mingw64安装

可以到官网下载mingw-w64-install.exe用来引导安装,也可以直接下载压缩包。按照提示安装即可。

插件安装

C/C++
Code Runner

launch.json文件配置

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

tasks.json文件配置

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

参考

Mingw-w64在win10下的安装使用
【VSCode】Windows下VSCode编译调试c/c++

vscode下搭建C/C++环境

标签:tar   ignore   ext   ref   load   build   als   blog   log   

原文地址:https://www.cnblogs.com/wheszza/p/12244761.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!