2

I am trying to set up my Neovim for C development however, whenever I use: #include <SDL2/SDL.h> I get an error saying "In included file: 'begin_code.h' file not found". I did some digging and in my include files and I did see 'begin_code.h'. I am just very confused, could be because I am new to C.

Screenshot of diagnostic message from Neovim's LSP

1 Answers1

1

So apparently, clangd can not find this headers. clangd needs specific files to find where your header file is.

According to clangd documentation, you can either generate a compile_commands.json file for your project or use compile_flags.txt.

For simple project, using compile_flags.txt is sufficient. Your compile flags are written one per line. A sample compile_flags.txt looks like this:

-Wall
-std=c++11
-L/usr/local/lib
-I/usr/local/include
-lfmt
jdhao
  • 24,001
  • 18
  • 134
  • 273