<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.next.codeblocks.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Eckard%27klotz</id>
	<title>Code::Blocks - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.next.codeblocks.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Eckard%27klotz"/>
	<link rel="alternate" type="text/html" href="https://wiki.next.codeblocks.org/index.php?title=Special:Contributions/Eckard%27klotz"/>
	<updated>2026-10-19T01:31:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.next.codeblocks.org/index.php?title=CB_Clangd_Client&amp;diff=9804</id>
		<title>CB Clangd Client</title>
		<link rel="alternate" type="text/html" href="https://wiki.next.codeblocks.org/index.php?title=CB_Clangd_Client&amp;diff=9804"/>
		<updated>2024-09-29T07:17:09Z</updated>

		<summary type="html">&lt;p&gt;Eckard&amp;#039;klotz: /* Windows: Compiler Clangd/LLVM Package Installer added name of clangd tools-extra package necessary  while using ucrt64*/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The repository page of this plugin is: [https://svn.code.sf.net/p/codeblocks/code/trunk/src/plugins/contrib/clangd_client https://sourceforge.net/projects/cb-clangd-client/]&lt;br /&gt;
&lt;br /&gt;
It uses [https://clangd.llvm.org/ clangd] through [https://en.wikipedia.org/wiki/Language_Server_Protocol Language Server Protocol].&lt;br /&gt;
&lt;br /&gt;
The related forum discussion is:  — [https://forums.codeblocks.org/index.php/topic,24357.html Code completion using LSP and clangd]&lt;br /&gt;
== &#039;&#039;&#039;What is Clangd&#039;&#039;&#039;==&lt;br /&gt;
&lt;br /&gt;
    clangd understands your C++ code and adds smart features to your editor:&lt;br /&gt;
:::* code completion&lt;br /&gt;
:::* compile errors &lt;br /&gt;
:::* go-to-definition &lt;br /&gt;
:::* go-to-implementation&lt;br /&gt;
:::* find references&lt;br /&gt;
:::   and more.&lt;br /&gt;
&lt;br /&gt;
    clangd is a language server that can work with your editor via a plugin.&lt;br /&gt;
    CodeBlocks provides Clangd_client as the needed plugin.&lt;br /&gt;
&lt;br /&gt;
    Clangd_client additionally enhances the clangd server by providing:&lt;br /&gt;
&lt;br /&gt;
:::* call tips&lt;br /&gt;
:::* function definitions&lt;br /&gt;
:::* parameter definitions&lt;br /&gt;
:::* previous and next function positioning&lt;br /&gt;
:::* symbols browser&lt;br /&gt;
:::* go-to-file&lt;br /&gt;
:::* go-to-function&lt;br /&gt;
:::* symbol renaming&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
==&#039;&#039;&#039;Configuring clangd_client&#039;&#039;&#039;==&lt;br /&gt;
:: Clangd_client requires the third-party binary clangd executable.&lt;br /&gt;
:: See &#039;&#039;&#039;Windows: Compiler Clangd/LLVM Package Installer&#039;&#039;&#039; below to install it.&lt;br /&gt;
:: or  &#039;&#039;&#039;Linux: Clangd executable install process&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
:: After a successful clangd executable install, perform the following:&lt;br /&gt;
:::Disable the &amp;quot;CodeCompletion&amp;quot; plugin.&lt;br /&gt;
::::* Navigate to Setting-&amp;gt;Plugins-&amp;gt;Manage Plugins and &#039;&#039;&#039;disable&#039;&#039;&#039; CodeCompletion.&lt;br /&gt;
::::* Navigate to Setting-&amp;gt;Plugins-&amp;gt;Manage Plugins and &#039;&#039;&#039;enable&#039;&#039;&#039; Clangd_client.&lt;br /&gt;
:::&#039;&#039;&#039;Restart Codeblocks&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:::Tell CodeBlocks (or verify) where the clangd executable resides:&lt;br /&gt;
::::* Navigate to Setting-&amp;gt;Editor-&amp;gt;Clangd_client-&amp;gt;C/C++ parser(tab) and verify or enter the location of the clangd executable in the box labeled &amp;quot;Specify clangd executable to use&amp;quot;.&lt;br /&gt;
::&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;&#039;Installing Clangd_client from source or pre-built binary &#039;&#039;&#039; ==&lt;br /&gt;
Note: Clangd_client is now included as a contrib plugin within the &amp;quot;Nightly&amp;quot; builds.&lt;br /&gt;
&lt;br /&gt;
Using a &amp;quot;Nightly&amp;quot; build is the easiest way to update to clangd_client.&lt;br /&gt;
&lt;br /&gt;
Simply install the &amp;quot;Nightly&amp;quot; and configure as specified below.&lt;br /&gt;
&lt;br /&gt;
See the Nightly builds at https://forums.codeblocks.org/index.php/board,20.0.html&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
#     Install the LLVM or Clangd.exe as documented in the section below entitled:&lt;br /&gt;
#: &#039;&#039;&#039;Windows Clangd executable install process&#039;&#039;&#039;&lt;br /&gt;
#::&amp;lt;br /&amp;gt;&lt;br /&gt;
#     Disable the Code completion plugin as follows:&lt;br /&gt;
#:    a) Open the Plugin manager via  Code::Blocks menu &lt;br /&gt;
#::         &amp;quot;MainMenu=&amp;gt;Plugins=&amp;gt;Manage plugins...&amp;quot; &lt;br /&gt;
#:    b) In the Manage Plugin dialog do the following:&lt;br /&gt;
#::          i  ) Find and select the &amp;quot;Code completion&amp;quot; plugin via it&#039;s title &lt;br /&gt;
#::          ii ) Press the &amp;quot;Disable&amp;quot; button on the right near the top&lt;br /&gt;
#::          iii) If you get any errors please try again.&lt;br /&gt;
#::&amp;lt;br /&amp;gt;	   &lt;br /&gt;
#    Install the Clangd-Client Plugin using one of the following options, which are documented below: &lt;br /&gt;
#:      a) Install via the Plugin Manager&lt;br /&gt;
#:      b) Manually install the plugin files&lt;br /&gt;
#:&amp;lt;br /&amp;gt;	&lt;br /&gt;
#    Configure the Clangd-Client Plugin for use as follows:&lt;br /&gt;
#:      a) Select the CodeBlocks menu item &amp;quot;Settings-&amp;gt;Editor...&amp;quot;&lt;br /&gt;
#:      b) In the list on the left click/select the &amp;quot;clangd_client&amp;quot; option.&lt;br /&gt;
#:      c) In the &amp;quot;C/C++ parser&amp;quot; tab change the &amp;quot;Specify clangd executable to use&amp;quot; to reference the clangd.exe you installed via step 1) above. &lt;br /&gt;
           Some examples of this could be:&lt;br /&gt;
              C:\msys64\clang64\bin\clangd.exe&lt;br /&gt;
              C:\msys64\clang32\bin\clangd.exe&lt;br /&gt;
              C:\msys64\mingw64\bin\clangd.exe&lt;br /&gt;
              C:\msys64\mingw32\bin\clangd.exe&lt;br /&gt;
              C:\LLVM\bin\clangd.exe&lt;br /&gt;
              C:\comilers\clang\clangd.exe&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;&#039;Manually Remove Clangd-Client Plugin&#039;&#039;&#039; ==&lt;br /&gt;
&lt;br /&gt;
#   Exit Code::Blocks!&lt;br /&gt;
#:&amp;lt;br /&amp;gt;&lt;br /&gt;
#   If you manually installed the files or used the Plugin manager then you can do the following:&lt;br /&gt;
#:  a) In the Code::Blocks &#039;&#039;&#039;...\share\CodeBlocks&#039;&#039;&#039; folder delete the clangd_client.zip file&lt;br /&gt;
#:  b) In the Code::Blocks &#039;&#039;&#039;...\share\CodeBlocks\plugins&#039;&#039;&#039; folder delete the clangd_client.dll file&lt;br /&gt;
#:&amp;lt;br /&amp;gt;&lt;br /&gt;
#        If you installed via the Plugin manager then you can delete the files with the following commands:&lt;br /&gt;
#:  a) del &#039;&#039;&#039;%APPDATA%\CodeBlocks\share\codeblocks\plugins\clangd_client.dll&#039;&#039;&#039;&lt;br /&gt;
#:  b) del &#039;&#039;&#039;%APPDATA%\CodeBlocks\share\codeblocks\clangd_client.zip&#039;&#039;&#039;&lt;br /&gt;
#:&amp;lt;br /&amp;gt;&lt;br /&gt;
#    If you want to reuse older code completion remember to re-enable the plugin and restart CodeBlocks.&lt;br /&gt;
#:&amp;lt;br /&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;&#039;Windows: Clangd executable install process:&#039;&#039;&#039; ==&lt;br /&gt;
&lt;br /&gt;
::There are three main options to install the clangd.exe:&lt;br /&gt;
#        Install the LLVM compiler.&lt;br /&gt;
#        Manully extract the required files from the LLVM compiler.&lt;br /&gt;
#        Install the Clangd package for the Windows compiler you are using if it is available.&lt;br /&gt;
:&amp;lt;br /&amp;gt;&lt;br /&gt;
::The  process for the three options above are detailed below.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;&#039;Windows: Install the LLVM compiler&#039;&#039;&#039; ==&lt;br /&gt;
&lt;br /&gt;
#    Download the latest (non RC/Beta) LLVM Windows executable for your OS (Win32 or Win64) from the following&lt;br /&gt;
#:       Github LLVM download page:&lt;br /&gt;
#:       https://github.com/llvm/llvm-project/releases/tag/llvmorg-18.1.8&lt;br /&gt;
#:&amp;lt;br /&amp;gt;&lt;br /&gt;
#:   As of Jan 2022 the Windows files are named as follows:&lt;br /&gt;
#:      LLVM-&amp;lt;version&amp;gt;-win64.exe&lt;br /&gt;
#:      LLVM-&amp;lt;version&amp;gt;-win32.exe&lt;br /&gt;
#:   where &amp;lt;version&amp;gt; is the LLVM version, like 13.0.0 or 13.0.1.&lt;br /&gt;
#:&amp;lt;br /&amp;gt;&lt;br /&gt;
#    Run the LLVM-&amp;lt;version&amp;gt;-win&amp;lt;xx&amp;gt;.exe you downloaded to install the LLVM compiler.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;&#039;Windows: Compiler Clangd/LLVM Package Installer&#039;&#039;&#039; ==&lt;br /&gt;
    Due to the number of different compilers available for Windows not all of the compilers will have either/both the Clang or LLVM required files.&lt;br /&gt;
&lt;br /&gt;
    If you want to install the specific package(s) for the Windows compiler you are using in order to use it&#039;s clangd.exe file please follow the instructions below for the specific compiler you have installed:&lt;br /&gt;
&lt;br /&gt;
    &#039;&#039;&#039;MSYS2 Compiler - MinGW64&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
        There are two main options to install the clangd.exe as follows:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;      1) The first option in order to  minimise disk space is to install the Clang extra &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;         tools using one of the following packages:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          +------------------------------------------+------------------------+&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          &amp;lt;nowiki&amp;gt;|               Package                    |&amp;lt;/nowiki&amp;gt; Clangd executable      |&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          +------------------------------------------+------------------------+&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          &amp;lt;nowiki&amp;gt;| mingw-w64-clang-x86_64-clang-tools-extra |&amp;lt;/nowiki&amp;gt; clang64/bin/clangd.exe |&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          &amp;lt;nowiki&amp;gt;| mingw-w64-x86_64-clang-tools-extra       |&amp;lt;/nowiki&amp;gt; mingw64/bin/clangd.exe |&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          &amp;lt;nowiki&amp;gt;| mingw-w64-ucrt-x86_64-clang-tools-extra  |&amp;lt;/nowiki&amp;gt; ucrt64/bin/clangd.exe  |&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          +------------------------------------------+------------------------+&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;         To intall the package do the following:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          a) Open the msys2.exe bash shell &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          b) Run the following command:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;                 pacman -S &amp;lt;Package name in the table above&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;   &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;      &amp;lt;nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/nowiki&amp;gt;OR&amp;lt;nowiki&amp;gt;&#039;&#039;&#039;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;  &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;      2) The second option is to intall the full Clang tool chain as follows:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          a) Open the msys2.exe bash shell &lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;          b) Run the following command:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt; &amp;lt;/nowiki&amp;gt;                 pacman -S mingw-w64-clang-x86_64-toolchain&lt;br /&gt;
&lt;br /&gt;
    &#039;&#039;&#039;MSYS2 Compiler - MinGW32&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
       There are two main options to install the clangd.exe as follows:&lt;br /&gt;
&lt;br /&gt;
       1) The first option in order to  minimise disk space is to install the Clang extra &lt;br /&gt;
          tools using one of the following packages:&lt;br /&gt;
&lt;br /&gt;
           +------------------------------------------+------------------------+&lt;br /&gt;
           |               Package                    | Clangd executable      |&lt;br /&gt;
           +------------------------------------------+------------------------+&lt;br /&gt;
           | mingw-w64-clang-i686-clang-tools-extra   | clang32/bin/clangd.exe |&lt;br /&gt;
           | mingw-w64-i686-clang-tools-extra         | mingw32/bin/clangd.exe |&lt;br /&gt;
           +------------------------------------------+------------------------+&lt;br /&gt;
&lt;br /&gt;
          To intall the package do the following:&lt;br /&gt;
            a) Open the msys2.exe bash shell &lt;br /&gt;
            b) Run the following command:&lt;br /&gt;
                  pacman -S &amp;lt;Package name in the table above&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &#039;&#039;&#039;OR&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
       2) The second option is to install the full Clang tool chain as follows:&lt;br /&gt;
          a) Open the msys2.exe bash shell &lt;br /&gt;
          b) Run the following command:&lt;br /&gt;
                  pacman -S mingw-w64-clang-i686-toolchain&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 -------------------------------------------------------------------------------------&lt;br /&gt;
 &#039;&#039;&#039;Notes from the CodeBlocks forum to avoid mixing incompatible gcc/clangd executables.&#039;&#039;&#039;&lt;br /&gt;
 -------------------------------------------------------------------------------------&lt;br /&gt;
    https://forums.codeblocks.org/index.php/topic,24357.msg169412.html#msg169412&lt;br /&gt;
&lt;br /&gt;
::: &#039;&#039;&#039;Don&#039;t mix mingw64 with clang64&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
:: If you are using the gcc from msys2, (the compilers in the folder &#039;&#039;&#039;msys64\mingw64\bin&#039;&#039;&#039;),&lt;br /&gt;
:: you should use &amp;quot;mingw-w64-x86_64-clang-tools-extra&amp;quot;, &lt;br /&gt;
:: (the clangd.exe is under the folder &#039;&#039;&#039;msys64\mingw64\bin&#039;&#039;&#039;) the same folder as your gcc.exe.&lt;br /&gt;
::&amp;lt;br /&amp;gt; &lt;br /&gt;
:: If you are using the clang tool chain, (the folder &#039;&#039;&#039;msys64\clang64\bin&#039;&#039;&#039;),&lt;br /&gt;
::	you should use &amp;quot;mingw-w64-clang-x86_64-clang-tools-extra&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
:: I found that I just make a big mistake. That is: I used the gcc toolchain from&lt;br /&gt;
:: &#039;&#039;&#039;msys64\mingw64\bin&#039;&#039;&#039;, but I used the clangd.exe from &#039;&#039;&#039;msys64\clang64\bin&#039;&#039;&#039;.&lt;br /&gt;
:: The result is I got a lot of LSP diagnostics messages and errors.&lt;br /&gt;
:: Luckily I found the reason, and fixed this issue. Hope this will help others.&lt;br /&gt;
::&amp;lt;br /&amp;gt;&lt;br /&gt;
-----&lt;br /&gt;
== &#039;&#039;&#039;Linux: Clangd executable install process:&#039;&#039;&#039; ==&lt;br /&gt;
::&lt;br /&gt;
::NOTE: Clangd_client plugin requires a clangd executable version 13 or greater.&lt;br /&gt;
::Check your current clangd version by running &#039;&#039;&#039;clangd --version&#039;&#039;&#039;&lt;br /&gt;
::If the version is less than 13 you will have to install a newer version.&lt;br /&gt;
:::See https://clangd.llvm.org/installation.html&lt;br /&gt;
::&amp;lt;br /&amp;gt;&lt;br /&gt;
::Installing the clangd package will usually give you a slightly older version.&lt;br /&gt;
::Test this by issuing &#039;&#039;&#039;apt-get install --dry-run clangd&#039;&#039;&#039;&lt;br /&gt;
::As of 2022/11/16, this suggest that clangd version 10 will be installed.&lt;br /&gt;
::If the clangd version shows less than version 13, you&#039;ll have to install a specific version as follows:&lt;br /&gt;
::&amp;lt;br /&amp;gt;&lt;br /&gt;
::Install a packaged release (&#039;&#039;must be version 13 or greater&#039;&#039;):&lt;br /&gt;
::::&#039;&#039;&#039;sudo apt-get install clangd-13&#039;&#039;&#039; &#039;&#039;(Must be version 13 or greater)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
::This will install clangd as &#039;&#039;&#039;/usr/bin/clangd-13&#039;&#039;&#039;.&lt;br /&gt;
::&amp;lt;br /&amp;gt;&lt;br /&gt;
:: You can now configure clangd_client plugin by following the above instructions at&lt;br /&gt;
:::: [https://wiki.next.codeblocks.org/index.php/CB_Clangd_Client#Configuring_clangd_client] &#039;&#039;&#039;Configuring clangd_client&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;br /&amp;gt;&lt;br /&gt;
:: If you prefer to install the entire LLVM/Clang package, for convenience, there is&lt;br /&gt;
:: an automatic installation script available that installs LLVM for you.&lt;br /&gt;
:: To install the latest stable version: see [https://apt.llvm.org/] &#039;&#039;&#039;Automatic installation script&#039;&#039;&#039;.&lt;br /&gt;
:: Note that you can specify the version number with this script.&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Eckard&#039;klotz</name></author>
	</entry>
</feed>