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
- VSCode ready to use out of the box (Only windows users need to correct MinGW installation path).
- Run
.\windows-reset.bat
in Windows or./ubuntu-reset.sh
in Ubuntu to reset theCurrent
Folder. - All
.cpp
files automatically take input frominput.txt
and output tooutput.txt
in the same folder. No need for complicatedifdef
s. - 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.
This is nice, thank you for sharing it!
I suggest having a non-debug mode, so as to enable compiler optimizations.
Great to see your interest in this!
Sure, this can be done. Can you please answer:
-Wshadow
,-Wall
,-O2
,-Wno-unused-result
-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.
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 andF6
for optimized..About configuring VSCode JSON Files, here is the official (and best) documentation.
Let me know if you have any other suggestions :)
Did you try acmX extention on vscode? It parses contests, makes input generator, stress tests the solution and more.
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.