LLVM Discussion Forums

Configuring clangd with compile_flags.txt to recognize an #include

I have a C++ project with a src file in src/libsuc/CacheCore.cpp and a different header file in src/libcore/EnergyMgr.h.

The header file is included like this

#include "libcore/EnergyMgr.h"

And I’m getting this error in LSP (through Sublime):

36:10    None            error       'libcore/EnergyMgr.h' file not found

I tried to configure compile_flags.txt to add src to the includes path but that doesn’t seem to be working:

$ cat compile_flags.txt
-std=c++0x
-Isrc
$ ls src/libcore/EnergyMgr.h
src/libcore/EnergyMgr.h
$ 

Any advice on how to fix this or what I should change in compile_flags.txt?

Could you also share clangd logs? Especially the lines containing compile commands, it should be of the form:

ASTWorker building file xxxx with command
[xxxx]
xxxxx