前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >如何让sublime text 2可以支持C语言的编译和run

如何让sublime text 2可以支持C语言的编译和run

作者头像
用户1203875
发布2018-06-19 17:38:28
6480
发布2018-06-19 17:38:28
举报
文章被收录于专栏:Rovo89Rovo89Rovo89

首先你得有一个编译器,对于 WindowsLinux 来说可以采用 gcc

Windows:

下载安装MinGW,然后在系统环境变量中添加

C:\MinGW\bin

(假设你把 MinGW安装在 C 盘) 最后在Sublime Text 2Tools –> 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"
}

Linux:

直接在 Package Control 安装一个叫 SublimeClang 的插件就可以了。 (Mac Win 没测试过) 或: 如果是 Ubuntu ,打开终端输入

 sudo apt-get install build-essential

不同的 Linux 发行版有不同的包管理,把 apt-get 换成你的系统的命令就好了。 最后在Sublime Text 2Tools –> Build System–> New Build System…输入如下内容并保存:

{
"cmd" : ["gcc", "$file_name", "-o", "${file_base_name}", "-lm", "-Wall"],
"selector" : "source.c",
"shell":false,
"working_dir" : "$file_path"
}

OS X:

下载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

Appreciate the author

Sweeping payments

 Pay by AliPay

 Pay by WeChat

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Windows:
  • Linux:
  • OS X:
    • Appreciate the author
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档