Home Download Buy Blog Forum Support

Compile one single C file

Compile one single C file

Postby Off on Sat Jan 14, 2012 12:13 am

Hi,

Since i can't find how to compile a single C file inside the editor, i'm willing to create a plugin for that, but before doing that, i want to know if any of you guys did a hack for that ?

Thanks.
Last edited by Off on Sat Jan 14, 2012 6:43 pm, edited 1 time in total.
Off
 
Posts: 3
Joined: Sat Jan 14, 2012 12:09 am

Re: Compile one single C file

Postby Off on Sat Jan 14, 2012 5:33 pm

Okay, so i didn't actually had to write a plugin, i just needed a build system.
Here it is :

Code: Select all
{
    "cmd": ["gcc", "$file", "-o", "$file_base_name"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "working_dir": "${project_path:${folder}}",
    "selector": "source.c"
}


If you want to add it to your Sublime Text, you just need to go Tools > Build System > New Build System and paste the code in the file then save it.
To Build, just hit Ctrl+b.

Hope it'll help some one.
Happy coding !
Off
 
Posts: 3
Joined: Sat Jan 14, 2012 12:09 am

Re: Compile one single C file

Postby Off on Sat Jan 14, 2012 6:47 pm

Ok, so now, i need it to actually Run the built file in my terminal.
How can i do that ?
Off
 
Posts: 3
Joined: Sat Jan 14, 2012 12:09 am


Return to Plugin Development

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests