DEV Community

Cover image for Setting up your Linux Environment for Competitive Coding(with Geany, in C++)
Abhishek Dutt
Abhishek Dutt

Posted on

Setting up your Linux Environment for Competitive Coding(with Geany, in C++)

In this article, we will learn how to setup an all-in-one Competitive Programming Environment.

Operating System

As mentioned above, we are gonna be using an OS, which comes under the Linux Distro. There are many popular distro out there, but for starters, Ubuntu is recommended, Kali and Arch Linux are for advance user.
If you are a Windows lover, then stick to Windows 7 or above versions.

Text Editor

There are many text editors out there, and you are open to choose from any one of it.
Since this post mainly focuses on the Linux Environment setup, I would prefer a text editor which is maintained by the open source community:- Geany. Its not the most convenient, but perfect for competitive programming.
There are other options as well:-

  1. VScode
  2. Sublime(is lightweight, and minimally aesthetic
  3. Notepad++
  4. Atom

Lets set up Geany


First thing first, we need to install it. You are open to install it either from Ubuntu Software or from the Official Geany Website.
You can also install using the terminal, copy the commands in your terminal:
For Ubuntu/ Debian:-
sudo apt-get install geany
For Fedora:
sudo dnf install geany
For CentOS:
sudo snap install geany-gtk --edge
You can also install plugins


Once you are done with installation, you can find Geany, using the search bar.


  1. Edit->Preferences->Keybindings
  2. Head to focus.
  3. Now change the following:
    1. Switch to Editor-> F1
    2. Switch to VTE-> F2


  1. Head to terminal, and select the check box Follow path of the current file.

Build and Compile

  1. First create any C++ file by typing anything in the text editor, and save it by cntrl+s, with a .cpp extension
  2. Head to Build->Set Build Commands
  3. Copy the following flags with the corresponding commands:-
    1. Compile (F8): g++ -std=c++17 -Wshadow -Wall -o "%e" "%f" -O2 -Wno-unused-result
    2. Build (F9): g++ -std=c++17 -Wshadow -Wall -o "%e" "%f" -g -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG

    You may get compilation error, if so, then try changing from C++17 to C++14, or remove the two sanitizers.

This is the basic set up for Competitive Programming in a Linux Environment, you can obviously set up another text editor like Sublime, with the other settings as well. I will make a post on that very soon.

Credits: The flags that I have used here, has been provided by Errichto, Link to GitHub
Thank You!
After complete setup, the environment should look like this:Alt Text

Top comments (0)