关于Windows下VScode配置c++环境的报告

关于Windows下VScode配置c++环境的报告
launch.json
代码(我用的是codeblocks的编译器)

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C++ Launch (GDB)",
            "type": "cppdbg",
            "request": "launch",
            "targetArchitecture": "x86",
            "program": "${workspaceRoot}\\${fileBasename}.exe",
            "miDebuggerPath": "F:\\codeblocks\\MinGW\\bin\\gdb.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "externalConsole": true,
            "preLaunchTask": "g++"
        }
    ]
}

task.json
代码

{
    "version": "0.1.0",
    "command": "g++",
    "args": [
        "-g",
        "${file}",
        "-o",
        "${fileBasenameNoExtension}.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
        }
    }
}

c_cpp_properties.json
代码(这边因为下了MinGW所以用它的了~这个比较靠谱推荐使用)

{
    "configurations": [
        {
            "name": "Win32",
            "intelliSenseMode": "clang-x64",
            "includePath": [
                "${workspaceFolder}",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/mingw32",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/backward",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include",
                "C:/MinGW/include",
                "C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "__GNUC__=7",
                "__cdecl=__attribute__((__cdecl__))"
            ],
            "browse": {
                "path": [
                    "${workspaceFolder}",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/mingw32",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include/c++/backward",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include",
                    "C:/MinGW/include",
                    "C:/MinGW/lib/gcc/mingw32/6.3.0/include-fixed"
                ]
            },
            "limitSymbolsToIncludedHeaders": true,
            "databaseFilename": ""
        }
    ],
    "version": 4
}

settings.json应该会自动生成,这里不多说了

添加好这些配置后只要下一个I/ORun即可运行尝试

不会的同学可以问我

加QQ 1446035688

最后预祝大家成功

截个图
关于Windows下VScode配置c++环境的报告_第1张图片

你可能感兴趣的:(关于Windows下VScode配置c++环境的报告)