Sublime Forum

Build and run C code

#1

Hello Sublime Forum,

I’m trying to get Sublime Text 3 to compile and run my C code.

I have installed MinGW and added it to my path.

and then went ahead and made the following Build System file:

{
"shell_cmd" : "gcc $file_name -o ${file_base_name}",
"working_dir" : "$file_path",
"variants":
  [
    {
      "name": "Run",
      "shell_cmd": "gcc $file_name -o ${file_base_name} && ${file_path}/${file_base_name}"
    }
  ]
}

Now my only issue is that I can’t get it to run the file once build.
If I build it, it works as intended, but if I run the Variant that is named Run, then the Sublime Console remains blank and the exe file that is build gets locked by Sublime (as in I have to close Sublime before I can rebuild or delete the exe file)

Would any of you intelligent people here on the Forum know how to solve my issue?

Thanks for reading!

0 Likes