Sublime Forum

How to configure cland lsp to use c++14

#1

I am using LSP-Cland for my c++ projects and I have configured the c++ build system to use -std=c++14. But the LSP is still using some older c++ version. I am saying this based on the warning that LSP is throwing.
eg warning: range-based for loop is a c++11 extension [-wc++11-extensions]
Also why in the world i am not able to copy the warning or errors that the LSP is showing in a pop up box.

0 Likes

#2

You modified your sublime build system, but you also need to inform clangd what the compiler flags are. You can do that by generating a compile_commands.json file or by writing a compile_flags.txt file by hand. in your case it’s probably easier to write the compile_flags.txt file by hand. It should contain the following content:

-std=c++14

This file should live at the root of your project directory. For more info see https://clangd.llvm.org/installation#compile_flagstxt

0 Likes