If you choose the Tools menu, Build System, New Build System you can create a file something like this:
- Code: Select all
"cmd": ["javac", "$file"],
I copied this from the default 'JavaC.sublime-build' file. You can replace "javac" with (presumably) "gcc". If the compiler is not in your environment paths then you'll need to supply the full path to it - but you'll need to escape the back-slashes "C:\\something\\else\\gcc"
"$file" means "the current file". You can probably delete the file_regex line. And your selector will be (presumably) "source.c", "source.cpp" or "source.c++". If the same compiler works for both c and c++ you can separate them with commas: "source.c, source.c++".
Save this file in your Packages\C++ or \User folder with the extension 'sublime-build'. You should probably restart ST2 and this new option should appear in the Build list. If you use it once then Ctrl-B will probably default to it in future.
I'm not sure about arguments; I assume you could bung them in with the $file: "-c -whatever $file". Andy.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.