首先你得有一个编译器,对于 Windows
和 Linux
来说可以采用 gcc
。
下载安装MinGW,然后在系统环境变量中添加
C:\MinGW\bin
(假设你把 MinGW
安装在 C
盘)
最后在Sublime Text 2
中Tools
–> Build System
–> New Build System
…输入如下内容并保存:
{
"cmd" : ["gcc", "$file_name", "-o", "${file_base_name}.exe", "-lm", "-Wall"],
"selector" : "source.c",
"shell":true,
"working_dir" : "$file_path"
}
直接在 Package Control
安装一个叫 SublimeClang
的插件就可以了。
(Mac
和 Win
没测试过)
或:
如果是 Ubuntu
,打开终端输入
sudo apt-get install build-essential
不同的 Linux
发行版有不同的包管理,把 apt-get
换成你的系统的命令就好了。
最后在Sublime Text 2
中Tools
–> Build System
–> New Build System
…输入如下内容并保存:
{
"cmd" : ["gcc", "$file_name", "-o", "${file_base_name}", "-lm", "-Wall"],
"selector" : "source.c",
"shell":false,
"working_dir" : "$file_path"
}
下载Xcode
,然后下载Command Line Tools
,最后在Sublime Text 2
的 Build System
中选择 C++
。
ok~很简单的
我的博客即将搬运同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=1xtpef3vdxmdg
Last modification:May 22nd, 2018 at 10:55 am
© The copyright belongs to the author
Support
If you think my article is useful to you, please feel free to appreciate
×Close
Sweeping payments
Pay by AliPay
Pay by WeChat