How to make clangd treat .c as c++ file?

Hi, I have my project all setup, compile_comands.json are ready. The problem is that this legacy project use “.c” suffix for c++ file. It seems clangd doesn’t agree. How can I enforce clangd to always treat .c file as c++?

You can specify -x c++ (or --language=c++) to clang to force it to use C++, or similarly for whatever other language. Would that be sufficient?

1 Like

Thank you. It works!