vscode 配置json文件记录

众所周知vscode的json文件配置比较麻烦,推荐整理配置好的一套json用来减轻后面配环境的折磨。
编译器使用的是MinGW64(clang和llvm一直没搞定),可以实现运行后弹出独立的黑框终端!生成的目标文件统一到一个文件夹!并无插件实现色彩高亮!

注意源码中的很多路径要换成自己的

vscode 配置json文件记录_第1张图片

vscode 配置json文件记录_第2张图片

c_cpp_properties.json文件(ctrl shift p -> edit configration 可生成此配置文件)

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "D:/DevelopSoft/MinGw64/mingw64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "compilerPath": "D:\\DevelopSoft\\MinGw64\\mingw64\\bin\\gcc.exe",
            "cStandard": "gnu17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-gcc-x64",
            "configurationProvider": "ms-vscode.makefile-tools"
        }
    ],
    "version": 4
}

launch.json(debug run 即可生成launch和tasks等json,我使用了IntelliSense插件)

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            // "type": "g++",
            "name": "task g++",
            "request": "launch"
        },
        {
            "name": "g++.exe build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "D:\\Code\\Vscode\\OUTPUTEXE\\${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "D:\\DevelopSoft\\MinGw64\\mingw64\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "preLaunchTask": "task g++"
        }
    ]
}

tasks.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "task g++",    //修改此项
            "command": "D:\\DevelopSoft\\MinGw64\\mingw64\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "D:\\Code\\Vscode\\OUTPUTEXE\\${fileBasenameNoExtension}.exe",
                "-fexec-charset=GBK"
            ],
            "options": {
                "cwd": "D:\\DevelopSoft\\MinGw64\\mingw64\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build"
        }
    ]
}

settings.json(该文件主要用来设置颜色字体等界面元素类型,可自己修改颜色)

{
    "editor.bracketPairColorization.enabled": true,
    "workbench.colorCustomizations": {
        "editorBracketHighlight.foreground1": "#ffd700",
        "editorBracketHighlight.foreground2": "#da70d6",
        "editorBracketHighlight.foreground3": "#87cefa",
        "editorBracketHighlight.foreground4": "#ffd700",
        "editorBracketHighlight.foreground5": "#da70d6",
        "editorBracketHighlight.foreground6": "#87cefa",
        "editorBracketHighlight.unexpectedBracket.foreground": "#ff0000"
    },
    "editor.fontSize": 20,
    "editor.fontFamily": "Consolas"
}

颜色显示如下:
vscode 配置json文件记录_第3张图片

你可能感兴趣的:(vscode 配置json文件记录)