Description:
I'm using clangd as my language server for coding c/c++ with CMake in vscode.
However, I'm experiencing some annoying bugs that keep interrupting me.
forehead/include.h' file not found clang(pp_file_not_found)
Bugs Reproduction:
I got a directory called include
which looks like this:
.
├── CMakeLists.txt
├── forehead
│ └── include.h
├── graph
│ └── graph.h
├── list
│ ├── linklist.h
...
In linklist.h
, clangd works fine with no errors or warnings, and I can jump to file include.h
with gd
:
#include <forehead/include.h>
But the exactly same line in graph.h
, clangd keeps give me the error:forehead/include.h' file not found clang(pp_file_not_found)
, preventing me from jumping to that file, every keyword or function from include.h
are treated as errors by clangd.
Environment:
- OS: macOS ventura 13.0
- clangd: 16.0.3
- CMake: 3.26.3
root/CMakeLists.txt
:
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
vscode/setting.json
:
"clangd.path": "/opt/homebrew/opt/llvm/bin/clangd",
"clangd.arguments": ["--header-insertion=never"],
"clangd.serverCompletionRanking": true,
Expectation:
It is worth mentioning that I can navigate within Vim and successfully build the .o
and executable files using CMake.
I'm tired of dealing with this annoying bug that keeps popping up every time I write a new header file.
(BTW: The bug may disappear for no apparent reason, perhaps the next time I open VSCode -- However, deliberately restarting the clangd or reloading the VSCode window does not seem to be effective.