Sublime Forum

Compile C code

#1

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.

0 Likes

#2

You have restarted Sublime Text since changing the path?

What happens if you type ‘make’ at the command line?

0 Likes

#3

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.”

0 Likes

#4

It sounds like it’s looking for a Makefile in the same directory as the file you’re editing, and not finding one.

0 Likes

#5

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

0 Likes

#6

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 :smile:

0 Likes

#7

moonlord: Generally you create your own make files for the projects you are working on. Are you new to C programming as well?

0 Likes

#8

@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 :\

0 Likes

#9

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.

0 Likes