I’ve used C++17 in VS Code. Now I want to use C++20 or C++23, but I can’t change from the C++17 version.
I’ve tried many ways, like adding "-std-c++2b" in Task.json or setting C++Standard to C++23, but my VS Code is still in C++17. Maybe I reinstalled VS Code and set it again?
2
Answers
I used
__cplusplus
to check version c++ , here is my complile when i use C/C++ and Code Runner extension :the result is
c++17
.I tried to run the compile with mingw64 from MSYS2 :![Run C/C++ file](data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20708%20138'%3E%3C/svg%3E)
the result is
c++20
. Another , i used C/C++ runner extension to run and the result still inc++17
:In the VSCode project browse the
.vscode
folder and in thetasks.json
type something like this (adapt it to your needs regarding the version):Also try to configure the
c_cpp_properties.json
:Finally rebuild your project. It should work for you.