When it comes to IOI or HKOI, C++ is the language of choice for its performance. Dev-C++ is provided at the competition as a C++ IDE, but its lack of autocomplete feature makes one feels like an animal when using it. When it comes to C++ coding, Visual Studio Code is as good as it gets. Thankfully, it is also available to contestants. However it’s not the easiest to configure. Here’s a step-by-step guide to setting it up on your computer.
But first, install Visual Studio Code on your computer if you haven’t already.
For Mac
For PC
Install Mingw-w64 (C++ compiler package)
First you need to install the g++ compiler and gdb debugger. (This is already done on the computers at the competition)
Mingw-w64 is the preferred option because it is the Linux development environment that your submission will be compiled under. Click on the Sourceforget.net link and install it to a folder that has no spaces in it. In other words, don’t install it to the default C:\Program Files\. Install it to C:\Mingw-w64.
Add compiler directory to PATH variable
- In the Windows Search box, type “env” and then choose Edit the system environment variables from the results list.
(If you’re on Chinese Windows, you may need to switch the display language to English first.) - Click into Environment Variables.
- Double Click on the
Path
Variable to edit it. It doesn’t matter whether you choose to edit User variables or System variables. Either would work. - Click “Edit Text” and add
C:\Mingw-w64\mingw32\bin
to the end. Put a “;” before appending the above folder name to the Path variable.In Windows 10, you can just click New and addC:\Mingw-w64\mingw32\bin
as an additional path.or (in Windows 7 or before)
The EASY way
- Download vscode_config.zip and extract it into a folder of your choosing.
- Close Visual Studio Code if it’s currently open. Then Launch Visual Studio Code. Choose File -> Open Folder…
- Open the folder you have just extracted the contents of vscode_config.zip into.
- If you had installed Mingw-w64 into C:\Mingw-w64 then you are done.
- Go into code.cpp in the editor, set a breakpoint and Hit F5 to debug!