My Sublime Text setup for Competitive Coding in C++

Sabuj Jana
4 min readFeb 24, 2019

I have tried all of the C++ IDEs but in the end, I have boiled down my choices to three of them, namely-

  1. Sublime Text
  2. CLion
  3. Geany

However, out of these three, I’ll say to go with Sublime Text.

Just so you know, Geany is used by Gennady Korotkevich aka tourist, hence, you can also have a look at that.

CLion , developed by JetBrains, is a C++ focused IDE just like IntelliJ for Java. It’s con is that is very slow and requires a paid license.

Enough of options, now lets narrow down to the best editor: Sublime Text.

Sublime is minimal,cool,focused,sleek and a very graceful IDE.

To set up your Sublime for C++ competitive programming, follow me:

  1. Download Sublime Text : A sophisticated text editor for code
  2. Install MinGW — The minimalist C++ GCC compiler for windows Minimalist GNU for Windows
  3. Install all of the Basic Setup of MinGW :

4. Now that GCC is up and running, we need to update the Environement Variables’ Path variable.

Go to My Computer> Right Click to get Properties> Advanced System Settings>Environment Variables.

Now under System Variables Tab, look for Path>Click on Path> Click on Edit>Click on New.

Now locate the MinGW installation folder in C drive.Inside it, locate the bin folder.

Copy the path of the bin folder. For me, it was like- C:\MinGW\bin

Paste this new path in the list and click OK.

Now Sublime should be able to access g++ from its terminal as the Path variable has been updated.

5. Phew! That was a lot. Now hang on- few more steps to get you started.

6. Open Sublime Text and create a new file and save it as <anyname>.cpp

Write the skeleton of a c++ code

Now go to Tools>Build System>C++ Single File

Now Click Build or Ctrl+B

You should get this in the Sublime Terminal

Bingo! You have officially configured Sublime for C++ code editing purpose.

7. Now the basic needs of a beginner will be met.

However, if you want to further configure your IDE for input files,output files,error files , just like the red coders on Codeforces do, hang on mate!

8. To allow access of your main .cpp file to external input,output and error files, just use this code:

Linking the i/p,o/p,error files

To support it, create 3 files namely input.txt, output.txt, error.txt in the same directory .

Now you can paste your sample input in input.txt file, compile and run your code, wait for the output to be displayed in output.txt file and error in error.txt file.

Cool!

Here is the screen setup you should have for optimal productivity :

I have 2 columns and the right column has 3 rows. You can play with the layout from the View Menu. I leave the design for you to configure and do whatever you deem best.

I believe I have demonstrated the entire process from scratch to get up Sublime up and running for C++ programming.

I also have a Code Snippet configuration that can inherit pre-written code as a template. All the code I have above can be inherited in a single tab stroke. If enough people are interested, comment down there and I’ll write about it in a separate answer.

Hope to see you on the leaderboard!

Peace!

Originally published at www.quora.com.

--

--

Sabuj Jana

Building software @Flipkart . ex-Amazon, Wells Fargo | Follow me for linux, k8s, go, elb, istio, cilium and other intriguing tech | https://janasabuj.github.io