Page 1 of 1

Need help setting up the clangd provided by the MSYS2 project

Posted: 14 Jun 2023 17:01
by bprlhe
It's different from the standalone clangd or the clangd provided by LLVM. The template for clangd of RJ TextEd is based on the clangd provided by LLVM. To get the MSYS2 clangd, install the package mingw-w64-clang-x86_64-toolchain with the pacman package manager on MSYS2 then add C:\msys64\clang64\bin to Windows' PATH. Clangd binary will be C:\msys64\clang64\bin\clangd.exe.

Re: Need help setting up the clangd provided by the MSYS2 project

Posted: 14 Jun 2023 17:09
by bprlhe
I asked this question because the settings by me seem not working. On Language server settings I set the Command to be C:\msys64\clang64\bin\clangd.exe and Initial folder to be C:\msys64\clang64\bin. Other settings are left with default values. When I working on an example source the language server tells me No matching function for call to 'sqrt'. It's very clearly that clangd can't find the include location (which is C:\msys64\clang64\include) so it can't find cmath to parse (I did included cmath in case you think I forgot to include the needed headers and I did specify the std namespace, e.g: std::sqrt so I'm pretty sure my code is correct). Strangely enough, this very same clangd version is working fine with Sublime Text.

Re: Need help setting up the clangd provided by the MSYS2 project

Posted: 15 Jun 2023 07:52
by Rickard Johansson
Try adding more source folders, like C:\msys64\clang64\include, if you haven't done so already.

BTW. If you use an initial folder, with the path to the command, then you can use clangd.exe as the command. No need to add the path.

Re: Need help setting up the clangd provided by the MSYS2 project

Posted: 15 Jun 2023 08:34
by bprlhe
No, it's RJ TextEd that is problematic. When I hover over #include <cmath> I found it correctly show the header's location as C:/msys64/clang64/include/c++/v1/cmath.

Re: Need help setting up the clangd provided by the MSYS2 project

Posted: 15 Jun 2023 08:42
by bprlhe
Well, you were right. Added C:\msys64\clang64\include to Source folders solved the problem. On Sublime Text, I don't need to do that, though.