0%

配置vscode

配置Visual Studio Code

  1. 在官网下载编译器

    https://www.mingw-w64.org/

  1. 搜索path找到环境变量,配置环境变量,点击Path,新建,输入

    1
    E:\Computer\mingw64\bin
  2. 打开cmd,输入指令看是否配置成功

    1
    g++ -v
  3. 打开vscode,下载插件C/C++和code runner,按住Ctrl + Shift + P,分别输入

    1
    Open Workspace Settings(JSON)
    1
    Edit Configurations(JSON)

    把生成的代码改成

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    {
    "configurations": [
    {
    "name": "Win32",
    "includePath": [
    "${workspaceFolder}/**"
    ],
    "compilerPath": "E:\\Computer\\mingw64\\bin\\g++.exe",
    "cStandard": "c17",
    "cppStandard": "c++23",
    "intelliSenseMode": "windows-gcc-x64"
    }
    ],
    "version": 4
    }
  4. 在coderunner勾选run in terminal,在executor map改cpp

    1
    "cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt -std=c++23 -O2 '-Wl,--stack=512000000' -w && $dir$fileNameWithoutExt",
  5. 安装oi runner++插件