Sublime Forum

Building and Running C code from within Sublime on Windows 8

#1

Hello everyone!

I am new to C programming and have been using Code::blocks on my PC for most of writing, building, and running my C code. However, this weekend, while using my Macbook Pro, I discovered the Sublime Text Editor and am loving it. I would like to start using it on PC to write my C code. However, I realized I now have no idea how to get sublime to build and run the C code.

So, several questions:

  1. Can I simply point sublime to the compiler that comes with code::blocks? Or do I need to download a new one?
  2. If I need to download a new compiler, which one is good?
  3. Finally, where can I find a “build system” script that will send my code to the compiler and then run it?

Thanks for your help everyone! :smile:

0 Likes

#2

I’m not sure about what comes with code::blocks but on windows I would recommend http://mingw.org/ as compiler…
I just wrote my own build system via Tools > Build System > New Build System…

{
    "cmd" : "gcc $file_name -o ${file_base_name} && open ./${file_base_name}"], // the build command
    "selector" : "source.c", // which files to use it for
    "shell": true, // open the terminal
    "working_dir" : "$file_path"
}

I think you would have to replace the “gcc” in the cmd part with whatever mingw needs… g++ if I remeber correctly!?

0 Likes