sublime配置C/C++编译环境

  • 先下载sublime(这是废话)

  • 配置C/C++编译环境

    • 进入DevC++文件夹目录image-20240419181911763
    • 复制上方地址
    • 右击我的电脑->点击属性->点击高级系统设置->环境配置->系统变量中点击path->新建将刚才的地址粘贴于此
    • win+r 输入 g++ -v出现版本即说明搭建成功
  • 配置编译文件

    • 运行sublime,点击工具->编译系统->新编译系统,会出现以sublime-build为后缀的文件,复制代码(文后附),粘贴覆盖原有即可,然后保存,分别命名为C和C++(.sublime-build)(什么?没有权限保存?试试管理员运行模式)

    C语言

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    {
    "working_dir": "$file_path",
    "cmd": "gcc -Wall \"$file_name\" -o \"$file_base_name\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "selector": "source.c",

    "variants":
    [
    {
    "name": "Run",
    "shell_cmd": "gcc -Wall \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\""
    }
    ]
    }

    C++语言

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    {
    "encoding": "utf-8",
    "working_dir": "$file_path",
    "shell_cmd": "g++ -Wall -std=c++11 \"$file_name\" -o \"$file_base_name\"",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "selector": "source.c++",

    "variants":
    [
    {
    "name": "Run",
    "shell_cmd": "g++ -Wall -std=c++11 \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\""
    }
    ]
    }
  • FastOlympicCoding插件下载

    • ctrl+shift+p 输入FastOlympicCoding下载
    • ctrl+b弹出终端运行,按esc键即可关闭结果运行框,再按i键,恢复insert状态
    • ctrl+alt+b弹出FastOlympicCoding右边运行框
    • alt+shift+1关闭右边的运行框分页窗口

献上参考博客:

sublime配置编译C/C++_sublime 指定c++编译版本-CSDN博客

sublime text 关闭编译结果框_sublime的下面的框框怎么关-CSDN博客

关于sublime text 如何使用fastolympiccoding插件实现高效刷题(循环测试)-CSDN博客