[quote=“agibsonsw”]If you choose the Tools menu, Build System, New Build System you can create a file something like this:
{
"cmd": "javac", "$file"],
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "source.java"
}
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.[/quote]
Thanks agibsonsw for the info… What about running the newly build application from sublime editor?
Is there a way to map the errors in the build to the line numbers. I know this is not IDE but having that feature will greatly help in debugging applications.
-Abhijeet