[技巧] NOI LINUX 中不用自己手打的Sublime配置环境
一般我们测试代码时,需要开 O2 ,而 Sublime 中的 C++ Single File 是没有 O2 的,为此,我们需要手打环境;
其实是不用的;
第一步,打开“文件”中的“其它位置”中的“计算机”;


第二步,在上面的搜索栏中搜索“Sublime”;

打开图中高亮的,找到如下图中高亮的并打开,复制;

发现会有如下的几行;
{
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
}
]
}
在倒数第四行中“&&”前加入-std=c++14 -O2 -Wall,即可完成;
如果想开大栈,在 g++ \"${file}\" 前加 ulimit -s 81920000(大约80MB)即可;
{
"shell_cmd": "g++ \"${file}\" -o \"${file_path}/${file_base_name}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c++",
"variants":
[
{
"name": "Run",
"shell_cmd": "ulimit -s 81920000 g++ \"${file}\" -o \"${file_path}/${file_base_name}\" -std=c++14 -O2 -Wall && \"${file_path}/${file_base_name}\""
}
]
}
最后,在 Sublime 中建立一个新的文件即可;
具体如下:
找到 Sublime 中的 tools ,选择里面的 Build system 中的 New build system;

在里面将如上的代码复制进去并保存即可;

大功告成!
浙公网安备 33010602011771号