Home Download Buy Blog Forum Support

Compile C code

Compile C code

Postby m0onlord on Wed Nov 04, 2009 8:40 pm

Hello,
How do i compile C programs in sublime? If i try to build it says:
"'make' is not recognized as an internal or external command, operable program or batch file."

I currently have installed devc++. I've added the path of make.exe(from devc++) to windows environment variables but still, sublime doesnt recognize make.

Thanks.
m0onlord
 
Posts: 6
Joined: Wed Nov 04, 2009 8:35 pm

Re: Compile C code

Postby jps on Thu Nov 05, 2009 1:40 am

You have restarted Sublime Text since changing the path?

What happens if you type 'make' at the command line?
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Compile C code

Postby m0onlord on Thu Nov 05, 2009 9:11 am

Yes, i did restarted sublime. It didnt worked before but now after pc restarts it's almost working. Now i get this error: "make: *** No targets specified and no makefile found. Stop."
m0onlord
 
Posts: 6
Joined: Wed Nov 04, 2009 8:35 pm

Re: Compile C code

Postby jps on Thu Nov 05, 2009 10:09 am

It sounds like it's looking for a Makefile in the same directory as the file you're editing, and not finding one.
jps
Site Admin
 
Posts: 3058
Joined: Wed Mar 19, 2008 12:33 pm

Re: Compile C code

Postby m0onlord on Thu Nov 05, 2009 1:12 pm

any ideea how to get that file? and shouldnt the editor have that kind of things? :roll:
m0onlord
 
Posts: 6
Joined: Wed Nov 04, 2009 8:35 pm

Re: Compile C code

Postby EJ12N on Thu Nov 05, 2009 4:26 pm

m0onlord wrote:any ideea how to get that file? and shouldnt the editor have that kind of things? :roll:

If the editor was exclusively for C language yes, but in this case is not. So the editor is not perfect but is extensible enough to customize to your own needs to suit everybody's taste :)
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Compile C code

Postby ToddFiske on Thu Nov 05, 2009 4:32 pm

moonlord: Generally you create your own make files for the projects you are working on. Are you new to C programming as well?
ToddFiske
 
Posts: 38
Joined: Wed Nov 04, 2009 10:43 pm

Re: Compile C code

Postby m0onlord on Thu Nov 05, 2009 6:33 pm

@ToddFiske: yes i'm new. I'm a webdeveloper so C/C++ wasn't my speciality until i got to college. Since i was already using sublime for php/html/css i thought i should write C in it too. I don't have a clue about what the makefile is. I'll do some research :\
m0onlord
 
Posts: 6
Joined: Wed Nov 04, 2009 8:35 pm

Re: Compile C code

Postby ToddFiske on Thu Nov 05, 2009 6:51 pm

You write a make file to tell your C compiler what files to pull together to compile your project into an executable. If it's not a large project (just a few source and header files for example) then you don't always need a make file, but it can still help by not having to type the compile command out each time. In the context of Sublime, it helps because you can also create and edit the make file in Sublime, and rebuild the whole project with one keypress.

Take baby steps: 1> figure out how to compile a test program from the command line; 2> write a simple make file and compile with it from the command line; 3> get it to compile from the make file within Sublime.

There will be plenty of info on the net for doing the first two, and then the third step should be easy.
ToddFiske
 
Posts: 38
Joined: Wed Nov 04, 2009 10:43 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 9 guests