Clangd issues with MinGW

I’ve been using Neovim with clangd for C, and I’m encountering an issue with my configuration when working with C++ files that include windows.h. While I’ve set up my configuration file config.yaml to use MinGW compilers without any problem for C files, it seems like clangd can’t find windows.h when processing C++ files.

These is my old config.yaml (was working well with c):

CompileFlags:
  Compiler: x86_64-w64-mingw32-gcc
  Add: ["-I../headers", "-I$INCLUDE_PATH"]

But now i want to work with c++, so
Here’s my new config.yaml:

If:
  PathMatch: .*.c .*.h

CompileFlags:
  Compiler: x86_64-w64-mingw32-gcc
  Add: ["-I../headers", "-I$INCLUDE_PATH"]
---

If:
  PathMatch: .*.cpp .*.hpp

CompileFlags:
  Compiler: x86_64-w64-mingw32-g++
  Add: ["-I../headers", "-I$INCLUDE_PATH"]
---

And these happens:

enter image description here

Even though the it compiles without any issues.

These is neovim LSP log if it’s can help.

[START][2024-05-01 19:22:24] LSP logging initiated
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:24.429] clangd version 17.0.3 (https://github.com/llvm/llvm-project 888437e1b60011b8a375dd30928ec925b448da57)nI[19:22:24.429] Features: linux+grpcnI[19:22:24.429] PID: 1238686nI[19:22:24.429] Working directory: /home/panda/path/tonI[19:22:24.429] argv[0]: /home/panda/.local/share/nvim/mason/bin/clangdnI[19:22:24.429] Starting LSP over stdin/stdoutnI[19:22:24.429] <-- initialize(1)n"
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:24.430] --> reply:initialize(1) 0 msn"
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:24.431] <-- initializednI[19:22:24.432] <-- textDocument/didOpennE[19:22:24.432] config error at /home/panda/.config/clangd/config.yaml:24:0: Config should be a dictionarynI[19:22:24.432] --> textDocument/publishDiagnosticsnI[19:22:24.432] Failed to find compilation database for /home/panda/path/to/main.cppnI[19:22:24.432] ASTWorker building file /home/panda/path/to/main.cpp version 0 with command clangd fallbackn[/home/panda/path/to]n/usr/lib/llvm-16/bin/clang -resource-dir=/home/panda/.local/share/nvim/mason/packages/clangd/clangd_17.0.3/lib/clang/17 -- /home/panda/path/to/main.cppn"
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:24.678] Built preamble of size 3580972 for file /home/panda/path/to/main.cpp version 0 in 0.25 secondsn"
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:24.678] --> workspace/semanticTokens/refresh(0)n"
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:24.679] Indexing c++17 standard library in the context of /home/panda/path/to/main.cppn"
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:24.679] <-- reply(0)n"
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "E[19:22:24.685] IncludeCleaner: Failed to get an entry for resolved path : No such file or directoryn"
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:24.685] --> textDocument/publishDiagnosticsn"
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:24.689] <-- textDocument/signatureHelp(2)n"
[ERROR][2024-05-01 19:22:24] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:24.691] --> reply:textDocument/signatureHelp(2) 2 msn"
[ERROR][2024-05-01 19:22:25] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:25.962] Indexed c++17 standard library (incomplete due to errors): 13604 symbols, 1918 filteredn"
[ERROR][2024-05-01 19:22:26] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:26.750] <-- textDocument/didSaven"
[ERROR][2024-05-01 19:22:26] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:26.750] File version went from 0 to 0n"
[ERROR][2024-05-01 19:22:26] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:26.800] Failed to find compilation database for /home/panda/path/to/main.cppn"
[ERROR][2024-05-01 19:22:26] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:26.800] ASTWorker building file /home/panda/path/to/main.cpp version 0 with command clangd fallbackn[/home/panda/path/to]n/usr/lib/llvm-16/bin/clang -resource-dir=/home/panda/.local/share/nvim/mason/packages/clangd/clangd_17.0.3/lib/clang/17 -- /home/panda/path/to/main.cppn"
[ERROR][2024-05-01 19:22:27] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:27.008] <-- textDocument/signatureHelp(3)n"
[ERROR][2024-05-01 19:22:27] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:27.016] --> reply:textDocument/signatureHelp(3) 7 msn"
[ERROR][2024-05-01 19:22:34] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:34.880] <-- textDocument/signatureHelp(4)n"
[ERROR][2024-05-01 19:22:34] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:34.888] --> reply:textDocument/signatureHelp(4) 7 msn"
[ERROR][2024-05-01 19:22:35] .../vim/lsp/rpc.lua:734    "rpc"   "/home/panda/.local/share/nvim/mason/bin/clangd"        "stderr"        "I[19:22:35.437] <-- shutdown(5)nI[19:22:35.437] --> reply:shutdown(5) 0 msn"

Is this problem related to my new config? If so, how can I configure clangd to use Mingw compilers for both C and C++?

Thanks!

I’ve tried adjusting the paths and configurations, but haven’t had any luck so far. Any suggestions on how to resolve this would be greatly appreciated.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật