2020-07-03 | C | UNLOCK

Sublime Text3 C/C++编译环境

Sublime配置

做的比较简单 参照C#改的 如果有scanf_s()这类输入将有BUG
vcvarsall.bat

bat

%cl.exe%/RunC C++.bat

1
2
3
4
5
6
7
8
9
10
11
12
13
@ECHO OFF
cd %~dp1
ECHO Compiling %~nx1.......
IF EXIST %~n1.exe (
DEL %~n1.exe
)
cl %~nx1
IF EXIST %~n1.exe (
ECHO -----------OUTPUT-----------
ECHO OK
:start /wait cmd.exe /k %~n1
start cmd.exe @cmd /k %~n1
)

c/c++.sublime-build

1
2
3
4
5
6
{
"cmd": ["RunC C++.bat", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.c,source.c++",
"encoding": "cp936"
}

test.c

1
2
3
4
5
6
7
#include <stdio.h>


int main(){
printf("Test Sublime Build..");
return 0;
}

test.cpp

1
2
3
4
5
#include <stdio.h>
int main(){
printf("test my sublime Cpp build");
return 0;
}
C C++

评论加载中