I recently tried running some code on VS Code but, as I’m using C++11 Standard code, I have to manually change the execution code in terminal to g++ -std=c++11
to actually run the code without errors.
I’m using Code Runner v0.11.8 by Jun Han
How can I set this option as the default?
2
Answers
On this page there is a Configuration section in which you have example how to specify compilation for c language. Write your own for C++ with flags you need and I think that it will be enough.
Follow below steps:
settings.json
& it’s done.
NOTE: Make sure VsCode terminal profile is Command prompt.
My setup:
You can use any version like -std=c++14 or -std=c++17.
Hope it helps