0

I recently started using nvim and started playing with some plugins. I found Mason to be extremely useful. However, I find it bit annoying that Mason diagnostics complain about missing header files (although they are not missing as I can compile and build). For example, look at the following case :

Screenshot

wx widgets library is installed and I am able to compile this file. My understanding is that LSP servers are not able to identify this file for some reason. Can someone help me in fixing this issue? Thank you.

I tried to reinstall wxwidgets library. Also, I can turn off diagnostics which is not what I want.

1
  • Interestingly, std library files like <string>, <memory> are recognized, where as files like <wx/bitmap.h> or <io2d.h> are not recognized. Commented May 7, 2024 at 19:14

3 Answers 3

0

Have you installed llvm ?

if not then install llvm with this command:

sudo apt install llvm

Also check your Mason & LSP config. For reference, you can see my configuration here

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for the suggestion. I tried to do this on my macbook but it errors out as : ❯ sudo apt install llvm The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt. Please visit java.com for information on installing Java. I installed Java as suggested in the message and it still doesn't work and errors with the same message. Can you please guide me on how to install llvm? Thanks.
It may not be llvm related - please look at my latest comment on the post. (It recognizes std files like <string> etc)
0

Mason is a package manager and therefore not the one providing diagnostics, but helping you install the diagnostics tools (language servers, debuggers, linters and formatters).

I’m assuming you installed clangd, but the diagnostics could be coming from any other package you may have installed. If you are indeed using clangd, have a look at the documentation here, project setup section.

You will find that there are multiple tools that can be used to help you configure neovim’s LSP client to interact with the language servers that you install. Understanding which LSP client tools and server(s) you are using is key here and will allow you to adjust configuration to and features/capabilities to your needs.

Comments

0

You need to setup compile_commands.json or compile_flags.txt to make clangd to understand your source code. You can use cmake or bear to generate it. Check https://clangd.llvm.org/installation#project-setup

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.