[英]In included file: 'begin_code.h' file not found occurring in Neovim LSP
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".我正在尝试为 C 开发设置我的 Neovim,但是,每当我使用:#include <SDL2/SDL.h> 时,我都会收到一条错误消息,提示“在包含的文件中:找不到‘begin_code.h’文件”。 I did some digging and in my include files and I did see 'begin_code.h'.
我做了一些挖掘,在我的包含文件中,我确实看到了“begin_code.h”。 I am just very confused, could be because I am new to C.
我只是很困惑,可能是因为我是 C 的新手。
Screenshot of diagnostic message from Neovim's LSP Neovim 的 LSP 的诊断信息截图
So apparently, clangd can not find this headers.所以显然,clangd 找不到这个头文件。 clangd needs specific files to find where your header file is.
clangd 需要特定文件来查找 header 文件的位置。
According to clangd documentation , you can either generate a compile_commands.json
file for your project or use compile_flags.txt
.根据clangd 文档,您可以为您的项目生成
compile_commands.json
文件或使用compile_flags.txt
。
For simple project, using compile_flags.txt
is sufficient.对于简单的项目,使用
compile_flags.txt
就足够了。 Your compile flags are written one per line.您的编译标志每行写入一个。 A sample
compile_flags.txt
looks like this:示例
compile_flags.txt
如下所示:
-Wall
-std=c++11
-L/usr/local/lib
-I/usr/local/include
-lfmt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.