Build systems in Sublime Text


I'm just beginning to learn programming (on C++ and Python), and by beginning I mean total beginning ("hello world" beginning...). Not wanting to use multiple IDE's, I would like to be able to code and build–simple–programs with my text editor, Sublime Text 2. Could someone indicate me, with a step-by-step tutorial, how to implement C++ and Python compiling and executing capabilities in Sublime Text.

I've searched Sublime Text build systems on the site, but the answers are very specific and can't help a rookie like me (but they'll probably help me later).


7/30/2012 9:00:46 PM

Accepted Answer

Sublime Text 2 already comes with scripts for building and running Python and C++ programs.

Simply press Cmd+B (or Ctrl+B on Windows & Linux) when a .py or .cpp file is open. The Python file will automatically execute and show the result in the built in console.

For C++, you need to press Cmd+Shift+B (Ctrl+Shift+B on Windows & Linux) to run it after building.

You need to have Python installed (get it here for Windows), and also a C++ compiler. The build system for C++ tries to call g++ by default (get it here for Windows. Remember to select the C++ compiler when installing!).

You will need to add the directories to path (c:\python32\ or similar for python, c:\mingw\bin or similar for the C++ compiler).

On windows, you may experience problems running the C++ programs (it tries to use bash). But Ctrl+B builds the program, and you can then use a command line to run it. Python works flawlessly on Windows.

8/29/2014 8:02:21 AM

windows(install minigw, python2.7 and added to the system path)

  1. build: ctrl+b
  2. run: ctrl+shift+b


  1. build and run: ctrl+b

you may try to learn the the .sublime-build files in your Tools -> Build system -> New build system

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow