codeict's blog

By codeict, history, 4 days ago,

I was unable to find a simple yet powerful CP setup for my needs, so I decided to create one myself. I hope someone will find this useful.

This setup uses C++ in VSCode with debugging support for users in Windows and Ubuntu.

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)

Please feel free to post Issues/Suggestions at the Github Repository.

Github Repository

Installation video for Windows on Youtube

Installation video for Ubuntu on Youtube

• +45

 » 4 days ago, # |   +5 This is nice, thank you for sharing it!I suggest having a non-debug mode, so as to enable compiler optimizations.
•  » » 4 days ago, # ^ | ← Rev. 3 →   +17 Great to see your interest in this!Sure, this can be done. Can you please answer: Is there any other benefit to this apart from faster execution while testing. Are these all the parameters you would look for: -Wshadow, -Wall, -O2, -Wno-unused-result
•  » » » 3 days ago, # ^ | ← Rev. 2 →   +5 Nothing else I can see. I would add -std=c++17, -march=native, -fsanitize=signed-integer-overflow,undefined. Those can be added in the debug mode too. Btw, it'll be nice if you also explain how to change some of the settings, like adding a compiler flag and playing with these JSON files, so that one can override some settings if he needs to.
•  » » » » 3 days ago, # ^ |   +14 I have added the compilation arguments here. Some of them were failing in Windows and have been commented for Windows only.Regarding an Optimized Build, the best that VSCode can support currently is to ask the user everytime for which build to run.. i.e debug or optimised. This will be a nuisance (and actually take more time than its saving). I will wait till this issue in VSCode is resolved. Then maybe you can press F5 for debugging and F6 for optimized..About configuring VSCode JSON Files, here is the official (and best) documentation.Let me know if you have any other suggestions :)
 » 4 days ago, # |   +15 Did you try acmX extention on vscode? It parses contests, makes input generator, stress tests the solution and more.
•  » » 4 days ago, # ^ | ← Rev. 2 →   +9 Yes, that is a great extension. I did come across it while searching for a setup.In my understanding it serves a different purpose though. It kicks in after you have created your code locally and automates the test-checking and submission process. You should still be able to use it on top of this setup.My purpose here is to allow writing and debugging c++ code locally without having to setup VS Code.