CP-VSCode-Setup icon indicating copy to clipboard operation
CP-VSCode-Setup copied to clipboard

A Competitive Programming Setup (C++) in Windows and Ubuntu

CP-VSCode-Setup

A Competitive Programming setup using VSCode for C++ users in Windows and Ubuntu with Debugging support.

Installation video for Windows on Youtube

Installation video for Ubuntu on Youtube

Features

  1. VSCode ready to use out of the box (Only windows users need to correct MinGW installation path).
  2. Run .\windows-reset.bat in Windows or ./ubuntu-reset.sh in Ubuntu to reset the Current Folder.
  3. All .cpp files automatically take input from input.txt and output to output.txt in the same folder. No need for complicated ifdefs.
  4. Leverage powerful features of VSCode:
    • Step Through Debugging (Execute the code line by line, Hover over variables to get values)
    • Debug Console (View any object i.e. map, set, vector or any complex object)
    • Zen Mode (Utilize your screen to the fullest)

Setup Image

Prerequisites

Windows

  1. Follow Steps 1-4 from Official VSCode Windows Prerequisites
  2. Check your MinGW installation

You are good to go!

Ubuntu

  1. Follow Steps 1-2 from Official VSCode Linux Prerequisites
  2. Make sure g++ is installed
    • Install
    sudo apt-get update
    sudo apt-get install g++
    sudo apt-get install gdb
    
    • Check Installation
    g++ --version
    gdb --version
    

You are good to go!

Installation

  1. Download this repository and extract folder CP-VSCODE-SETUP.
  2. Open VSCode. Click on File->Open Folder->CP-VSCODE-SETUP
  3. Open a Terminal by clicking on Terminal->New Terminal or press Ctrl+`
  4. You can always create a Current Folder from terminal by
    • Windows
    .\windows-reset.bat
    
    • Ubuntu
      • Make the script executable (Only needed once)
      chmod +x ubuntu-reset.sh
      
      • Execute the script
      ./ubuntu-reset.sh
      
    Note: To reset the Current Folder at any time, you may run this command again.

MinGW package version issue in Windows

Your MinGW package version may be different. In this case, you should update the gcc.exe, g++.exe and gdb.exe locations in the .vscode configuration files.

Usage

  1. You should write your code in the Current Folder.
  2. Press F5 to run any .cpp file. The file will automatically take input from input.txt and write output to output.txt

Happy Coding!

Issues and Suggestions

Please create a Github Issue should you come across an Issue or have a suggestion. I will be happy to resolve it at the earliest.