how can i compile my code in C language in sublime text 2 ? I am new to this editor ,please help !
Help compiling and running C code
You need a build file (.sublime-build) that will appear under the Tools menu, Build System. You can copy and modify an existing one, or do a search for a C-version. This is my C++ version (I think it’s based on the default?).
[code]{
“cmd”: “g++”, “${file}”, “-o”, “${file_path}/${file_base_name}”],
“file_regex”: “^(…^:]):([0-9]+):?([0-9]+)?:? (.)$”,
“working_dir”: “${file_path}”,
“selector”: “source.c, source.c++”,
"variants":
{
"name": "Run",
"cmd": "${file_base_name}.exe"]
//"cmd": "bash", "-c",
//"g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}[/code]
Alternatively, there may be a C-Package that you can install.
Is there any explanation to each of this entries ? I mean, I know what a working_dir is. But I don’t know what is a file_regex, selector & variants. Can anybody explain please ?
The keys and what they do are in the build system section of the documentation.
I also have a video series that explains things in more detail.