How to compile and run a simple C program with Sublime Text 2?

c, gcc, macos, sublimetext, sublimetext2

Solution

Mac OS X:

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

Windows:

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

Problem

I want to compile a simple C program with GCC. What do I need to put in the sublime-build file to do so?

Original source

Related problems