[SOLVED] Is there a way to specify the c++ standard of clangd without recompiling it?

Issue

This Content is from Stack Overflow. Question asked by Aaron Liu

I’m trying to use a feature in c++17(const lambdas) without having clangd error me. I’ve searched online and every answer tells me to recompile it with a flag. Is there truly no other way?



Solution

Answer inspired by n. 1.8e9-where’s-my-share m.

From https://clangd.llvm.org/config#compileflags:

You can create a config file for clangd. In the config file, you can specify the compiler options mimicked. For my question, do this:

CompileFlags:
  Add: [-std=c++20]


This Question was asked in StackOverflow by Aaron Liu and Answered by Aaron Liu It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?