MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.72k stars 254 forks source link

how to set ccls to search c++ standard headers automatically #945

Closed FH0 closed 1 year ago

FH0 commented 1 year ago

compile_commands.json does not contains -I/usr/include/x86_64-linux-gnu/c++/11 and -I/usr/include/c++/11. This error will be emitted 'shared_mutex' file not found.

If I add -I/usr/include/x86_64-linux-gnu/c++/11 and -I/usr/include/c++/11 to compile_commands.json, there is no error.

It seems my ccls can't find c++ standard headers automatically. I don't know which settings I changed. ccls was able to work properly yesterday.

Headers and sources are no problem because I can use cmake to compile my project without an error.

System information

hikycool commented 1 year ago

The same problem that I also met. And Ccls only include standard header file but miss project header file while setting "-I/usr/include/c++/11" in ".ccls" file.

FH0 commented 1 year ago

Finally solved by apt purge libgcc-12-dev -y

hikycool commented 1 year ago

My way is "apt install gcc-12 g++-12” on Ubuntu-22.04 instead of gcc-11 before.