苹果Mac如何运行C程序2
- 2020 年 3 月 27 日
- 筆記
Mac使用Sublime Text 3 搭建C开发环境
1、命令行安装gcc
brew install gcc
2、工具栏打开Tools->Build System->New Build System

打开New Build System后,在新建的文件中输入以下内容,保存成C.sublime-build。
{ "cmd": ["gcc", "${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" : ["${file_path}/${file_base_name}"] } ] }
3、command+shift+p 调出搜索框后 搜索build 出现Build with c 即成功。

4、快捷键:cmd+b(编译),shift+cmd+b(运行)

