Home Download Buy Blog Forum Support

Help compiling and running C code

Help compiling and running C code

Postby ankur.sao7 on Sat Sep 01, 2012 11:37 am

how can i compile my code in C language in sublime text 2 ? I am new to this editor ,please help !
ankur.sao7
 
Posts: 3
Joined: Fri Aug 17, 2012 2:08 pm

Re: Help compiling and running C code

Postby ankur.sao7 on Sun Nov 25, 2012 3:26 pm

is compiling and executing possible with sublime ?
ankur.sao7
 
Posts: 3
Joined: Fri Aug 17, 2012 2:08 pm

Re: Help compiling and running C code

Postby agibsonsw on Sun Nov 25, 2012 5:35 pm

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: Select all
{
   "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}'"]
      }
   ]
}

Alternatively, there may be a C-Package that you can install.
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 17 guests