在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" }
写入一下内容
#include "stdio.h" struct student { char name[20]; int age; }; int main(int argc, char const *argv[]) { struct student Result = {"XiaoMing", 12}; printf("%s\n", Result.name); printf("%d\n", Result.age); return 0; }
现在用快捷键Cmd+B编译输出结果
时间: 2024-11-05 18:43:35