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:-
- VScode
- Sublime(is lightweight, and minimally aesthetic
- Notepad++
- Atom
Lets set up Geany
Installation
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
Configure
Once you are done with installation, you can find Geany, using the search bar.
KeyBindings
- Edit->Preferences->Keybindings
- Head to focus.
-
Now change the following:
- Switch to Editor-> F1
- Switch to VTE-> F2
Terminal
- Head to terminal, and select the check box Follow path of the current file.
Build and Compile
- First create any C++ file by typing anything in the text editor, and save it by cntrl+s, with a .cpp extension
- Head to Build->Set Build Commands
- Copy the following flags with the corresponding commands:-
- Compile (F8): g++ -std=c++17 -Wshadow -Wall -o "%e" "%f" -O2 -Wno-unused-result
- 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:
Top comments (0)