Update VSCode to C++20

3k Views Asked by At

I am trying to use Visual Studio Code with C++20 with clangd.

Unfortunately it seems to be running in C++98. I get the following error when using basic things like std::function enter image description here

I have updated as many settings as I can see to C++20, and the __cplusplus macro now also says 2020. However this problem still persists.

I can compile without issues using: g++ --std c++20 main.cpp -o main

I am also missing a few .json files. I only have tasks.json in my .vscode folder.

1

There are 1 best solutions below

0
On

Clangd does not use c_cpp_properties.json for configuration, that file is specific to Microsoft's vscode-cpptools extension.

To configure your project for use with clangd, you need to follow the procedure described here: https://clangd.llvm.org/installation#project-setup