sublime c++ 环境配置

  1. 安装sublime, mingw, 将mingw路径添加至环境变量
  2. 安装插件Package Control
import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())
  1. 安装插件ConverttoUTF8 解决文件乱码
  2. 新建编译系统,选择tool –> Build System –> New Build System,添加代码并保存为c++.sublime-build
{
    "working_dir": "$file_path",
    "shell_cmd": "g++ -Wall -std=c++11 -g \"$file_name\" -o \"$file_base_name\" && size \"$file_base_name\".exe",
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "selector": "source.c++",
 
    "variants": 
    [
        {   
        "name": "Debug",
            "shell_cmd": "start cmd /c \"gdb \"${file_path}/${file_base_name}\"\""
        },
        {   
        "name": "CMD Run",
            "shell_cmd": "g++ -Wall -std=c++11 -g \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\""
        },
        {   
        "name": "Run with Input",
            "shell_cmd": "g++ -Wall -std=c++11 -g \"$file\" -o \"$file_base_name\" && \"${file_base_name}\" < in.txt "
        }
    ]
}
  1. 添加GDB调试快捷键,选择Preference –>Key Bindings 添加代码
{"keys": ["f5"], "command": "build","args": {"variant": "Debug"} }  

OK

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容