Sublime text linux gcc build for simple C programs

I want to create programs in the built-in sublime text build command 2

I created the gcc.sublime-build file with

{
"cmd" : ["gcc", "$file_name", "-o", "${file_base_name}"],
"selector" : "source.c",
"shell":true,
"working_dir" : "$file_path"
}

but all i get is a mistake saying

gcc: fatal error: no input files compilation completed. [Finished at 0.0 with exit code 4]

any ideas

+5
source share
2 answers

Sublime Text runs gccwithout parameters, because it "shell": truemeans that the value "cmd"is passed to the shell and should be a single line. It seems in your file that you want to pass parameters directly to GCC, so you should set "shell"to false.

+5
source

I would do this with a Makefile:

CC=gcc
all: source

make.

0

All Articles