小编yao*_*ohu的帖子

VScode clangd 找不到我的头文件未找到 `clang(pp_file_not_found)`

描述:

\n

我使用clangd作为语言服务器,在 vscode 中使用 CMake 进行 c/c++ 编码。

\n

然而,我遇到了一些烦人的错误,这些错误一直困扰着我。

\n

forehead/include.h\' file not found clang(pp_file_not_found)\n在此输入图像描述

\n

错误再现:

\n

我有一个名为的目录include,如下所示:

\n
.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 CMakeLists.txt\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 forehead\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 include.h\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 graph\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 graph.h\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 list\n\xe2\x94\x82   \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 linklist.h\n...\n
Run Code Online (Sandbox Code Playgroud)\n

在 中linklist.h,clangd 工作正常,没有错误或警告,我可以使用以下命令跳转到include.h文件gd

\n
#include <forehead/include.h>\n
Run Code Online (Sandbox Code Playgroud)\n

但是,clangd 中的完全相同的行graph.h不断给我错误:forehead/include.h\' file not found clang(pp_file_not_found),阻止我跳转到该文件,每个关键字或函数都include.h被 clangd 视为错误。

\n

环境:

\n
    \n
  • 操作系统:macOS 文图拉 13.0
  • \n
  • 铿锵:16.0.3
  • \n
  • CMake:3.26.3
  • \n
\n

root/CMakeLists.txt …

c visual-studio-code clangd

4
推荐指数
1
解决办法
5993
查看次数

标签 统计

c ×1

clangd ×1

visual-studio-code ×1