您的位置:首页 > 编程语言 > C语言/C++

Sublime text3 配置c++环境 并设置快捷键

phpfish 2019-10-12 00:04 441 查看 https://www.cnblogs.com/dyhaoh

VScode配c++环境太麻烦了 打算用sublime写C++ 记录一下配置过程
因为我是有DEV环境的 直接将MINGW64加入环境变量即可 在DEV文件夹下的MinGW64\bin(就是有g++.exe的那个文件夹)

加到PATH里面就行

然后新建编译系统:

 

点“新建编译系统”

然后将文件改为:

{
"cmd": ["g++","-Wall", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"encoding":"cp936",
"variants":
[
{
"name": "Run",
"cmd": ["cmd", "/c", "g++", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "cmd", "/c", "${file_path}/${file_base_name}"]
},
{
"name": "RunInCommand",
"cmd": ["cmd", "/c", "g++", "-Wall","${file}", "-o", "${file_path}/${file_base_name}", "&&", "start", "cmd", "/c", "${file_path}/${file_base_name} & echo.&pause"]
}
]
}

保存即可

然后设置运行快捷键:
在首选项里点快捷键设置:
添加:

[
{
"keys": ["f11"],
"command": "build",
"args": {"variant": "RunInCommand"}
}
]

这样每次点f11就是在cmd里运行了

标签: