转载:在Mac下用Sublime Text3 架设C开发环境
在Sublime Text中, 点击 Tools -> Build System -> New Build System... 会弹出一个配置文件的模版将模版中的内容替换成结果:
{ "cmd" : ["gcc", "-o", "$file_base_name", "$file_name"], "cmd" : ["./$file_base_name"], "selector" : "source.c", "shell" : false, "working_dir" : "$file_path" }
写入一下内容
1 #include "stdio.h" 2 3 struct student 4 { 5 char name[20]; 6 int age; 7 }; 8 9 int main(int argc, char const *argv[]) 10 { 11 struct student Result = {"XiaoMing", 12}; 12 13 printf("%s\n", Result.name); 14 printf("%d\n", Result.age); 15 16 return 0; 17 }
现在用快捷键Cmd+B编译输出结果