Skip to content

Instantly share code, notes, and snippets.

@maurerbot
Created June 20, 2012 23:27
Show Gist options
  • Save maurerbot/2962898 to your computer and use it in GitHub Desktop.
Save maurerbot/2962898 to your computer and use it in GitHub Desktop.
Getting Sublime Text to build a C file.

C Sublime Text Build

This builds single C files in Sublime Text, handy for testing small things.

Works With

  • OSX (Assuming xcode installed)
  • Linux (Should work if gcc is installed)
  • Windows (Need CL working)

Thanks to adnansky for Linux Test and Shell update.

Sourced from https://gist.github.com/2962898

{
"cmd": ["g++", "$file", "-o", "$file_base_name", "-I/usr/local/include"],
"selector": "source.c++",
"windows":
{
"cmd": ["cl", "/Fo${file_path}", "/O2", "$file"]
}
}
{
"cmd": ["gcc -Wall ${file} -o ${file_base_name} && ./${file_base_name}"], "working_dir": "${file_path}",
"selector": "source.c",
"shell": true,
"windows":
{
"cmd": ["cl", "/Fo${file_path}", "/O2", "$file"],
"selector": "source.c",
"shell": true
}
}
{
"cmd": ["gcc", "$file", "-o", "$file_base_name", "-I/usr/local/include"],
"selector": "source.c++",
"windows":
{
"cmd": ["cl", "/Fo${file_path}", "/O2", "$file"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment