How to compile and run C in sublime text 3?

前端 未结 12 1176
生来不讨喜
生来不讨喜 2020-11-30 20:33

I would like to compile and run C program in sublime text 3 on ubuntu 14.04. Currently the program is being compiled with gcc using sublime text 3 executing a command (see b

12条回答
  •  隐瞒了意图╮
    2020-11-30 21:11

    Have you tried just writing out the whole command in a single string?

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

    I believe (semi-speculation here), that ST3 takes the first argument as the "program" and passes the other strings in as "arguments". https://docs.python.org/2/library/subprocess.html#subprocess.Popen

提交回复
热议问题