Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the version of the C++ language standard used in VS Code?

I printed the value of the __cplusplus macro and found out that my files are executed with C++98 in Visual Studio Code. I'm using the CodeRunner extension.

How do I change this to C++17?

like image 673
Hilberto1 Avatar asked Sep 01 '25 09:09

Hilberto1


1 Answers

Go to extensions, then type ms-vscode.cpptools in the search bar.

Click on the C/C++ extension, and to the right of Uninstall, there should be a gear icon. Click it.

A dropdown menu should open. Select Extension Settings.

Now click in the search bar (sometimes it makes you click twice before you can type without replacing the extension filter) and type cppStandard.

From here, you should see two options, one for Cpp Standard, and one for C Standard.

Change Cpp Standard to your desired version. I generally use c++20.

enter image description here

like image 141
Vendetta Avatar answered Sep 04 '25 00:09

Vendetta