Skip to content

Latest commit

 

History

History
155 lines (94 loc) · 5.1 KB

windows.md

File metadata and controls

155 lines (94 loc) · 5.1 KB

VS Code Config

Intro

This repository is about how to install and setup vs code for competitive programming (actually easy input & output) with c/c++ for windows users.

Note for old users of this repo : There were some problems with bash in windows, so i had to convert the tasks.json file for cmd (Command Prompt). If you are using this new json file then, please select cmd as default profile for vscode terminal. check this out

How To Configure

Note : You just need to do these things only for the first time of your workspace!

Pre-requirements

Need VS Code and C++ Compiler mingw installed in your windows pc.

Installing VS Code

Installing mingw

Setting Up Environment For C/C++

  • In you pc search for system environment

    search system environment

  • Go to Environment variables (on advance section)

    Environment Variables

  • On system variable section, select path. Then click edit, select new & paste the link of your mingw bin folder. (Most probably its in C:\MinGW\bin, find it. For me it is C:\MinGW\bin)

    Path Select

  • Select ok>ok>apply>ok for everything.

Test MinGW path setup is working

  • Open cmd (can search in the search section) and type gcc and hit enter

  • If you find

    gcc: fatal error: no input files
    compilation terminated.

    or something like that then congrats :3

  • else if you cmd says :

    'gcc' is not recognized as an internal or external command,
    operable program or batch file.

    Then go back to the Install mingw and check everything again.

Setup VS Code

  • In VS Code, Open your coding folder (From Menu bar : file->open folder ) File | Menu

  • Click on terminal (At the top Menu bar) Terminal | Menu

  • Select configure task..

  • Select create task.json from template

  • Select others and it will create a new tasks.json file in your default folder under .vscode folder. The folder structure will be like this :


Your Default Folder (Workspace)
├───.vscode
│      ─── tasks.json

More things to do

  • Split screen in 3 sections
    • split the main section in right (right click of mouse on a file and u will get the split options)
    • then split the right section into up-down (same as below) Split Options
  • create a file named input.txt
  • create a file named output.txt
  • open input.txt into the upper right section
  • open output.txt into the lower right section

This will be the final look of your vs code :

Final Look of VS-Code

How To Use

Open your workspace Folder where you will code your shits.

Create your .cpp file, write code and give inputs in input.txt and press Ctrl+Shift+b and your output will be in the output.txt file.

Note : Make sure your mouse cursor is clicked or focused on the cpp file editor while you are running your code.

New Note : I have came to know that some new comers or vscode users sometimes just open the file in vscode instead of opening as folder and press Ctrl+Shift+b which will not work. So please open vscode in your desired folder. Open VS Code, then you can go to Menu -> File -> Open Folder ... FILE | MENU

In the Repository i have also added config files for other Programming Languages too :

VS CODE Snippet

This one is made for my personal usage, you can add functions as you wish and edit my name and doc.

Setup

  • Select User Snippets (at top menubar, File/Code [for mac] > Preferences > User Snippets) and then select cpp.json. Top Bar
  • copy or replace the cpp.json file and save.

Usage

  • Creating a cpp file if you type inc and press Tab in your keyboard the snippet will load as i have set prefix as inc in my json file . (You can edit as your own !)
  • This will make programming easy and fast .

Snippets

Happy coding :3