Need help setting up the clangd provided by the MSYS2 project

Tips and information on how to install and use language servers with the editor.
Post Reply
bprlhe
Posts: 26
Joined: 01 Apr 2023 06:26

Need help setting up the clangd provided by the MSYS2 project

Post 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.
bprlhe
Posts: 26
Joined: 01 Apr 2023 06:26

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

Post 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.
User avatar
Rickard Johansson
Site Admin
Posts: 6628
Joined: 19 Jul 2006 14:29

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

Post 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.
bprlhe
Posts: 26
Joined: 01 Apr 2023 06:26

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

Post 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.
bprlhe
Posts: 26
Joined: 01 Apr 2023 06:26

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

Post 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.
Post Reply