My addiction towards Sublime Text desists me from laying my hands on any other code/text editors… Compiling, Building and Running C++ was one of the biggest reason to use other code editors like CodeBlocks, etc..
For C++ only, I started using CodeBlocks. But after some time I realized that its interface is so boring and was far behind Sublime even though it has a built-in compiler, its interface was so dull.
So I started searching and google-ing to find out is there a way by which we can compile C++ programs in Sublime. After an hour or so I found the solution which is not so hard.
So lets get started …
Installing MinGW (C++ Compiler)
- First, download the latest MinGW from here.
- Install it in the C:/MinGW (recommended) drive and then press Finish to continue.
- Now locate your bin folder. According to the steps it should be here: C:/MinGW/bin
- Now add it to the PATH evironment variables.
- To do that, go to : Start >> Control Panel >> System >> Advanced >> Environment Variables
- Click on New under User Variables.
- Now type MinGW in the Variable name field and the Location of your bin folder in the Variable value field and press OK
- THATS IT ! You have successfully installed MinGW.
Now its time to set it up with Sublime.
Setting up with Sublime
- NOTE: Save all your .cpp files in the bin directory only without putting in a folder. Your files should not be in a folder there path sould be like this: C:/MinGW/bin/YourFileName.cpp
- Now open Sublime.
- Go to: Tools >> Build System and make sure that C++ is selected.
FINALLY DONE! You have finally completed the tutorial.
Now get going Sublimers. Press Ctrl + B to Build and Ctrl + Shift + B to Run.