内容纲要

setting.json

配置终端,可在终端执行命令行编译 g++ -g main.cpp

  "terminal.integrated.shell.windows": "D:\\nginxstack\\msys64\\usr\\bin\\bash.exe",
  "terminal.integrated.shellArgs.windows": ["-i"],
  "terminal.integrated.env.windows": {
    "PATH": "/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/"
  }

c_cpp_properties.json

配置选项,可在 vscode 状态栏右下角选择。

{
  "configurations": [{
      "name": "Win32",
      "includePath": ["${workspaceFolder}/**"],
      "defines": ["_DEBUG", "UNICODE", "_UNICODE"],
      "windowsSdkVersion": "10.0.17763.0",
      "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe",
      "cStandard": "c11",
      "cppStandard": "c++17",
      "intelliSenseMode": "msvc-x64"
    },
    {
      "name": "MinGW",
      "intelliSenseMode": "clang-x64",
      "includePath": [
        "${workspaceRoot}",
        "D:/nginxstack/msys64/mingw64/include",
        "D:/nginxstack/msys64/mingw64/include/c++/8.3.0",
        "D:/nginxstack/msys64/mingw64/include/c++/8.3.0/tr1",
        "D:/nginxstack/msys64/mingw64/include/c++/8.3.0/x86_64-w64-mingw32",
        "D:/nginxstack/msys64/mingw64/x86_64-w64-mingw32/include"
      ],
      "defines": [
        "_DEBUG",
        "UNICODE",
        "__GNUC__=8",
        "__cdecl=__attribute__((__cdecl__))"
      ],
      "browse": {
        "path": [
          "D:/nginxstack/msys64/mingw64/lib/*",
          "D:/nginxstack/msys64/mingw64/include",
          "D:/nginxstack/msys64/mingw64/include/c++/8.3.0",
          "D:/nginxstack/msys64/mingw64/include/c++/8.3.0/tr1",
          "D:/nginxstack/msys64/mingw64/include/c++/8.3.0/x86_64-w64-mingw32",
          "D:/nginxstack/msys64/mingw64/x86_64-w64-mingw32/include"
        ],
        "limitSymbolsToIncludedHeaders": true,
        "databaseFilename": ""
      }
    }
  ],
  "version": 4
}

launch.json

配置调试

{
    // 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": [

        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/a.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [],
            "externalConsole": true,
            "MIMode": "gdb",
            "miDebuggerPath": "D:/nginxstack/msys64/mingw64/bin/gdb.exe",
            "setupCommands": [{
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
            }]
        }

    ]
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注