下载对应平台的sublime


sublime最新版下载, 字体样式个人喜欢Consolas, 另附注册码:

—– BEGIN LICENSE —–
TwitterInc
200 User License
EA7E-890007
1D77F72E 390CDD93 4DCBA022 FAF60790
61AA12C0 A37081C5 D0316412 4584D136
94D7F7D4 95BC8C1C 527DA828 560BB037
D1EDDD8C AE7B379F 50C9D69D B35179EF
2FE898C4 8E4277A8 555CE714 E1FB0E43
D5D52613 C3D12E98 BC49967F 7652EED2
9D2D2E61 67610860 6D338B72 5CF95C69
E36B85CC 84991F19 7575D828 470A92AB
—— END LICENSE ——

Mac下配置


选择Tools > Build System > New Build System创建一个编译模板,名字命名为C++11

文件内容如下:

{
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++", "variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "g++ -std=c++11 '${file}' -o 'a' && open -a terminal '${file_path}/a'"]
}
]
}

配置中的open -a terminal指的是从终端打开该文件, 如果不需要,可以将其去掉。

编写一个简单的c++程序测试一下

Windows下配置

c++环境设置

  1. 在系统环境变量Path中添加MinGW > bin所在目录,

    点击下载MinGW

  2. 同样在Tools > Build System > New Build System新建编译模板,保存为C++11.sublime-build

    内容为:

C++.sublime-build

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

oj刷题常用模版


sublime中可以添加代码片段

创建方法:Tools (工具)> Developer > New Snippet(新片段)

1、在新建的文件中添加如下内容

<snippet>
<content>
<![CDATA[
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <fstream>
#include <list>
#include <iomanip>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(s) memset(s, 0, sizeof(s))
const int inf = 0x3f3f3f3f;
#define LOCAL int main(int argc, char * argv[])
{
#ifdef LOCAL
freopen("/Users/huangjiaming/Documents/Algorithm/oj/data.in", "r", stdin);
//freopen("/Users/huangjiaming/Documents/Algorithm/oj/data.out", "w", stdout);
#endif ${1:/* code */} while (~scanf("%d", ${2:/* var */}))
{ } return 0;
}]]>
</content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>acm</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.c++</scope>
</snippet>

2、保存为acm.sublime-snippet

3、使用方法,在你的c++文件中输入acm关键字,再按下Tap键

效果如下

最新文章

  1. Guava Supplier实例
  2. 【Win10 开发】读取PDF文档
  3. 搭建eclipse+github开发环境
  4. hdu 2964 Prime Bases(简单数学题)
  5. 手把手教你WEB套打程序开发
  6. 【暑假】[实用数据结构]前缀树 Trie
  7. Ora-12154:无法解析连接字符串
  8. 延迟加载并渐现内容的jquery插件lazyFade
  9. php 图片上传预览(转)
  10. Android开发之漫漫长途 Ⅳ——Activity的显示之ViewRootImpl初探
  11. awk进阶整理
  12. 【移动开发】一张图搞定Activity和Fragment的生命周期
  13. .Net语言 APP开发平台——Smobiler学习日志:基于Access数据库的Demo
  14. C++ 浅拷贝与深拷贝探究
  15. NSL:SOFM神经网络实现预测哪个样本与哪个样本处在同一层,从而科学规避我国煤矿突水灾难—Jason niu
  16. awt多线程聊天
  17. GO语言的进阶之路-网络安全之proxy
  18. AndroidStudio 之 Inter x86 Emulator Accelerator(Haxm installer) - not compatible with windows
  19. 跟bWAPP学WEB安全(PHP代码)--认证绕过与会话管理
  20. ML: 聚类算法R包 - 模型聚类

热门文章

  1. Asp.net常用的51个代码(非常实用)
  2. c3p0+spring
  3. 使用POCO发送HTTP(S)请求
  4. proc_create的使用方法
  5. Hihocoder #1098 : 最小生成树二&#183;Kruskal算法 ( *【模板】 )
  6. 书写优雅的shell脚本(插曲)- /proc
  7. CALayer和UIView
  8. 「LuoguP3384」【模板】树链剖分
  9. JQ的双向数据绑定
  10. 单片机知识是Linux驱动开发的基础之一