You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VS Code配置Clang时出现头文件错误,请求帮助

头文件错误求助

C开发时碰到头文件错误,已通过MSYS2安装gcc、g、gdb,用LLVM安装了clangd,错误截图如下:
错误截图

我用Code Runner编译运行文件,下面是完整的compile_flags.txt和settings.json片段,求解决这个错误的方法:

compile_flags.txt 内容

-std=c++20
-Wall
-Wextra
-g

-IC:/msys64/mingw64/include/c++/14.2.0
-IC:/msys64/mingw64/include/c++/14.2.0/x86_64-w64-mingw32
-IC:/msys64/mingw64/include

-IC:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/14.2.0/include

-isystem C:/msys64/mingw64/include/c++/14.2.0
-isystem C:/msys64/mingw64/include/c++/14.2.0/x86_64-w64-mingw32
-isystem C:/msys64/mingw64/include
-isystem C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/14.2.0/include

-nostdinc++
-D__GNUC__
-D__MSYS__
-D__STDC_HOSTED__

-I.

settings.json 片段

{
  "clangd.path": "C:\\LLVM\\bin\\clangd.exe",
  "clangd.arguments": [
    "--compile-commands-dir=.",
    "--query-driver=C:/msys64/mingw64/bin/g++.exe"
  ]
}

内容的提问来源于stack exchange,提问作者Srivatsav

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 19:27:16