为什么找不到lsp clangd linting fr Irror;

发布于 2025-01-18 16:37:47 字数 690 浏览 5 评论 0原文

lsp linting clangd 抛出 linting 错误 当做一个包含 例如 #include;错误位/c++config.h 文件未找到

我已经安装了 mingw(通过 choco install)并将其添加到我的路径中 还尝试添加包含
在此处输入图像描述

与 LLVM 相同! 在此处输入图像描述

但是当我尝试使用 cmake 构建 hello world 程序时,它可以工作 正如预期的那样。 在此处输入图像描述

我还将compile_command.json复制到由cmake生成的根目录 在此处输入图像描述

我花了 2 天来解决这个问题,但仍然没有运气,

这是 linting 问题。 (lsp cland 窗口) 在此处输入图像描述

非常感谢任何帮助。

lsp linting clangd throws a linting error
when doing an include
e.g
#include <iostream> error bits/c++config.h file not found

I already installed mingw(via choco install) and added it to my path
also tried added the includes
enter image description here

same with LLVM!
enter image description here

but when I tried to build a hello world program using cmake it works
as expected.
enter image description here

I also copied the compile_command.json to my root generated by cmake
enter image description here

I been spending 2 days to solve this, but still no luck

here's the linting problem. (lsp clangd windows)
enter image description here

any help is greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ヅ她的身影、若隐若现 2025-01-25 16:37:47

最后,由于 lsp clangd 配置错误而发生包含错误

。啊。叹息..我修好了。我从一开始就做错了事。
无需添加标志来包含所有内容,例如 -I 已丢失的内容。 clangd 本身没有任何问题。问题出在您的 lsp 配置上。

我正在使用 windows,powershell,没有 wsl,nvim -> lunarvim 和 cmake
修复很简单,只需添加编译命令路径
在你的 clang lsp 配置上的 --query-driver

之后,一切都应该工作得很好并且顺利

the include errors occur because of wrong lsp clangd config

Finally. ah. sigh.. I fixed it. I'm doing things wrong from the start.
there's no need to add flags to include everything e.g -I that has been missing. There's nothing wrong on the clangd itself. The problem lies on your lsp config.

I'm using windows,powershell, no wsl, nvim -> lunarvim and cmake
the fix is simple you just need to add the compile command path
on your --query-driver on your clang lsp config

after that everything should work nice and smooth

早茶月光 2025-01-25 16:37:47

由于错误的 lsp clangd 配置而发生包含错误

这是我解决问题的解决方案

这是您应该进入 --query-driver 的路径,
请记住,这取决于您的compile_command.json。

cmake 生成的compile_command.json

你的 --query-driver 应该与你的命令路径相同在您的compile_command.json

lsp clangd config

之后列出有关错误缺少的包含现在应该消失

错误消失

the include errors occur because of wrong lsp clangd config

here is my solution for solving the issue

here's the path that you should have into your --query-driver,
remember it depends on your compile_command.json.

compile_command.json generated by cmake

Your --query-driver should be the same as your command path listed on your compile_command.json

lsp clangd config

after that errors about missing includes should gone by now

errors gone

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文