Author Topic: Code completion using LSP and clangd  (Read 180461 times)

Offline gd_on

  • Lives here!
  • ****
  • Posts: 797
Re: Code completion using LSP and clangd
« Reply #360 on: March 04, 2024, 07:53:12 pm »
Quote
Please tell me the version of gcc and clangd you're using so I can exactly mirror your evnvironment.
It's the last versions from msys2 distribution, updated last week. gcc, clang ... in the same mingw64 directory.
Windows 11 64 bits (23H2), svn C::B (last version or almost!), wxWidgets 3.2.4 (tests with 3.3), Msys2 Compilers 13.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

Offline garwin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code completion using LSP and clangd
« Reply #361 on: March 11, 2024, 09:48:15 pm »
I have tried this new plugin which seems quite interesting and much better replacement for code completion plugin but I am struggling to set up everything correctly.
Win11 Codeblocks svn 13485, compiler MinGW-W64 x86_64-msvcrt-posix-seh, built by Brecht Sanders) 13.1.0

There are several interesting things I will try to describe.

1. run Codeblock through CbLauncher.exe vs. directly codeblocks.exe
note: I am using directly codeblocks.exe through a problem to setup color schemes using CbLauncher

In this case, after enable plugin, the plugin is inactive (using directly codeblocks.exe) with information that CB need to be restarted and compiler set. After restart plugin is inactive and there is no access to setting for plugin.
note: In case using CBLauncher, it does work.

2. LSP messages (using through CBLauncher)
I got really big bunch of errors, it seems that there is no recognition of templates, std namespace, includes headers etc.
Point2.hpp|126|error:Unknown type name 'T'
TestPoint2.hpp|14|error:Use of undeclared identifier 'std'
TestPoint2.hpp|3|error:In included file: 'concepts' file not found 
- this is linked to #include <concepts>

This is probably problem with settings but what can be done?
I have installed the 4 files specified in wiki manually in Clangd folder under Codeblocks and set the path in C/C++ parser tab.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Code completion using LSP and clangd
« Reply #362 on: March 12, 2024, 12:01:05 am »
@garwin

For my clarity, and some things I don't understand.
Quote
note: I am using directly codeblocks.exe through a problem to setup color schemes using CbLauncher
I don't understand what "problem to setup color schemes" means.

Quote
I have installed the 4 files specified in wiki manually in Clangd folder under Codeblocks and set the path in C/C++ parser tab.

What four files did you install and where did you install them?

Have you disabled CodeCompletion plugin first, then enabled Clangd_Clinet plugin second. from MainMenu/plugins/ManagePlugin. CodeCompletion plugin and Clangd_client plungin cannot run together.

After doing the above enable/disable of plugin, you must then restart CodeBlocks.

Again, very important that CodeCompletion be disabled and Clangd_client be enabled and CodeBlocks restarted. See the image below. CodeCompletion must show as greyed out.

Then, using MainMenu/Settings/Editor/Clangd_client/C++Parser (tab) set the full path location of clangd.exe.
« Last Edit: March 12, 2024, 12:05:14 am by Pecan »

Offline garwin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code completion using LSP and clangd
« Reply #363 on: March 12, 2024, 10:08:28 pm »
@Pecan

I did it exactly as you describe except last step (see bellow)
I think I was able to dig into the problem, but do not know the solution.

I use codeblock.exe directly which saves settings in Windows in AppData\Roaming.
I did not change these settings after I updated to the last nightly build (previously using the last official version of codeblocks).

But using this old setting means that I can disable this old CodeCompletion plugin and enable Clangd_clinet plugin however cannot setup Clangd_client because I have no options to do so in Settings/Editor. There are all different settings (General setting, Folding ....) but no Clangd. So after restarting codeblocks, Clangd_client is disabled.



« Last Edit: March 12, 2024, 10:17:07 pm by garwin »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Code completion using LSP and clangd
« Reply #364 on: March 13, 2024, 07:15:12 pm »
@garwin

Please provide the following information so that I can setup my environment the same as yours and try to detect the error.

Within code tags (the # icon above the reply box) provide the appdata\roaming\codeblocks\ "personality" causing the problem. In the example below the "personality" is "default" at the bottom right of the codeblocks window (yours may be different). It will reside at \users\<your pc users name>\appdata\roaming\codeblocks\<personality name>.conf .

Also provide the codeblocks log (within code tags). The title of the tab is "Code::Blocks". It may look empty, but just use the mouse wheel up or down to see the data.
Right click on the tab title and select copy to clipboard.
Then paste it between code tags so we can analyze it.

Tell me exactly how to start codeblocks.exe the same way you do to cause the error.
« Last Edit: March 13, 2024, 07:27:32 pm by Pecan »

Offline garwin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code completion using LSP and clangd
« Reply #365 on: March 13, 2024, 07:58:09 pm »
@Pecan
Thank you for helping, I am just hobbiest, so these toolchains and all the settings are difficult to me, but I like simplicity and your plugin would really help compared to code completion plugin which sometimes works, sometimes does not, especially for member functions.

I have just finished an additional try and was able to make Clangd plugin work but with an obscure way and not fully. See below. So now I need:
- to make plugin Clangd working with standard library (point 1 below)
- to find why I need really obscure way to run that plugin (point 2 below)

1. Actual status - The plugin is working but anything from std namespace does not
It seems, that that Clangd is unable to locate library headers. I have added to the compiler search directory:
... Codeblocks\MinGW 13.1\include
... Codeblocks\MinGW 13.1\include\c++
... Codeblocks\MinGW 13.1\include\c++\13.1.0
... Codeblocks\MinGW 13.1\lib\gcc\x86_64-w64-mingw32\13.1.0\include
... Codeblocks\MinGW 13.1\lib\gcc\x86_64-w64-mingw32\13.1.0
... Codeblocks\MinGW 13.1\lib\gcc\x86_64-w64-mingw32

It did not help.

This is from LSP message:
Code
LSP diagnostics: main.cpp|:|----Time: 19:49:39.185---- (4 diagnostics)|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TESTS\_WORKING\TEST_CLANGD\TEST_CLANGD\main.cpp|1|error:In included file: 'bits/c++config.h' file not found|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TESTS\_WORKING\TEST_CLANGD\TEST_CLANGD\main.cpp|5|error:No member named 'cout' in namespace 'std'|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TESTS\_WORKING\TEST_CLANGD\TEST_CLANGD\main.cpp|5|error:No member named 'endl' in namespace 'std'|
C:\Users\tnadrchal\Documents\_Ostatni\C++\TESTS\_WORKING\TEST_CLANGD\TEST_CLANGD\main.cpp|1|warning:Included header iostream is not used directly (fix available) remove #include directive|


This is basic testing code.
Code
#include <iostream>

int main()
{
    std::cout << "Test" << std::endl;
    return 0;
}

Code
Loaded config file 'C:\Users\tnadrchal\AppData\Roaming\CodeBlocks\default.conf' (personality: 'default')
Scanning for lexers in C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\share\codeblocks/lexers/...
Found 62 lexers
Loading lexer_A68k
Loading lexer_ada
Loading lexer_angelscript
Loading lexer_autotools
Loading lexer_bash
Loading lexer_batch
Loading lexer_bibtex
Loading lexer_caml
Loading lexer_cg
Loading lexer_cmake
Loading lexer_coffee
Loading lexer_cpp
Loading lexer_css
Loading lexer_cu
Loading lexer_d
Loading lexer_diff
Loading lexer_f77
Loading lexer_fortran
Loading lexer_glsl
Loading lexer_gm
Loading lexer_haskell
Loading lexer_hitasm
Loading lexer_html
Loading lexer_ihex
Loading lexer_inno
Loading lexer_java
Loading lexer_javascript
Loading lexer_latex
Loading lexer_lisp
Loading lexer_lua
Loading lexer_make
Loading lexer_markdown
Loading lexer_masm
Loading lexer_matlab
Loading lexer_nim
Loading lexer_nsis
Loading lexer_objc
Loading lexer_OgreCompositor
Loading lexer_OgreMaterial
Loading lexer_pascal
Loading lexer_perl
Loading lexer_plain
Loading lexer_po
Loading lexer_postscript
Loading lexer_powershell
Loading lexer_prg
Loading lexer_properties
Loading lexer_proto
Loading lexer_python
Loading lexer_rc
Loading lexer_registry
Loading lexer_ruby
Loading lexer_smalltalk
Loading lexer_sql
Loading lexer_squirrel
Loading lexer_srec
Loading lexer_tehex
Loading lexer_vbscript
Loading lexer_verilog
Loading lexer_vhdl
Loading lexer_xml
Loading lexer_yaml
Configured 0 tools
Scanning for plugins in C:\Users\tnadrchal\AppData\Roaming\CodeBlocks\share\codeblocks\plugins
Loaded 0 plugins
Scanning for plugins in C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\share\codeblocks\plugins
Tools Plus Plugin: Registering shell type Piped Process Control
Loaded 65 plugins
Loading:
Abbreviations
AStylePlugin
Autosave
AutoVersioning
BrowseTracker
BYOGames
CB_Koders
Cccc
clangd_client
ClassWizard
CodeSnippets
CodeStat
Compiler
copystrings
CppCheck
Cscope
Debugger
FilesExtensionHandler
DevPakUpdater
DoxyBlocks
cbDragScroll
EditorConfig
EditorTweaks
EnvVars
Exporter
FileManager
FortranProject
Scanning for lexers in C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\share\codeblocks/lexers/...
Found 62 lexers
Loading lexer_A68k
Loading lexer_ada
Loading lexer_angelscript
Loading lexer_autotools
Loading lexer_bash
Loading lexer_batch
Loading lexer_bibtex
Loading lexer_caml
Loading lexer_cg
Loading lexer_cmake
Loading lexer_coffee
Loading lexer_cpp
Loading lexer_css
Loading lexer_cu
Loading lexer_d
Loading lexer_diff
Loading lexer_f77
Loading lexer_fortran
Loading lexer_glsl
Loading lexer_gm
Loading lexer_haskell
Loading lexer_hitasm
Loading lexer_html
Loading lexer_ihex
Loading lexer_inno
Loading lexer_java
Loading lexer_javascript
Loading lexer_latex
Loading lexer_lisp
Loading lexer_lua
Loading lexer_make
Loading lexer_markdown
Loading lexer_masm
Loading lexer_matlab
Loading lexer_nim
Loading lexer_nsis
Loading lexer_objc
Loading lexer_OgreCompositor
Loading lexer_OgreMaterial
Loading lexer_pascal
Loading lexer_perl
Loading lexer_plain
Loading lexer_po
Loading lexer_postscript
Loading lexer_powershell
Loading lexer_prg
Loading lexer_properties
Loading lexer_proto
Loading lexer_python
Loading lexer_rc
Loading lexer_registry
Loading lexer_ruby
Loading lexer_smalltalk
Loading lexer_sql
Loading lexer_squirrel
Loading lexer_srec
Loading lexer_tehex
Loading lexer_vbscript
Loading lexer_verilog
Loading lexer_vhdl
Loading lexer_xml
Loading lexer_yaml
HeaderFixup
Header Guard
HelpPlugin
Help plugin ini file: C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\share\codeblocks\docs\index.ini
HexEditor
IncrementalSearch
cbKeyBinder
lib_finder
LogHacker
ModPoller
MouseSap
NassiShneidermanPlugin
OccurrencesHighlighting
OpenFilesList
Profiler
ProjectOptionsManipulator
ProjectsImporter
RegExTestbed
ReopenEditor
rndgen
ScriptedWizard
SmartIndentCpp
SmartIndentFortran
SmartIndentHDL
SmartIndentLua
SmartIndentPascal
SmartIndentPython
SmartIndentXML
SpellChecker
SymTab
ThreadSearch
tidycmt
ToDoList
ToolsPlus
wxSmith
wxSmithMime
wxSmithAui
wxSmithContribItems
WindowsXPLookNFeel
Initial scaling factor is 1.000 (actual: 1.000)
Running startup script
Script plugin registered: Find Broken Files plugin
Script/function 'edit_startup_script.script' registered under menu '&Settings/-Edit startup script'
ClangdClient: allocating ProxyProject (phase 1).
Opening C:\Users\tnadrchal\AppData\Roaming\CodeBlocks/CC_ProxyProject.cbp
Done.
ClangdClient: loading ProxyProject (phase 2.
Opening C:\Users\tnadrchal\AppData\Roaming\CodeBlocks/CC_ProxyProject.cbp
Done.
Parsing 0 files took 0 ms
SpellChecker: Thesaurus files 'C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\share\codeblocks\SpellChecker\th_en_US.idx' not found!


2. How I did it.
I have not installed MinGW, I have just copy whole MinGW folder under Codeblocks and setup compiler after first opening correctly as it works.
Under Compiler setttings->Selected Compiler I always make copy of default (not setup) GNU GCC Compiler. In this case GNU GCC Compiler 13.1 and setup it correctly and make it default. Run easy code and check that it works.
But if I do that Clangd plugin is always automatically disabled on opening or inactive after enabling it. When I tried to setup original default GNU GCC Compiler in same way, it works and I get to point 1 describe above. This is really strange.

I have included config file in zip, I do not want to spam this forum as it is quite a number of rows.





Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Code completion using LSP and clangd
« Reply #366 on: March 13, 2024, 08:19:40 pm »
@ garwin

It looks like the problem is that neither Compiler nor Clangd_client can find the fully installed compiler.

How and where did you actually install (not copied) the mingw compiler?

How and where did you install (not copied) clangd?
« Last Edit: March 13, 2024, 08:21:36 pm by Pecan »

Offline garwin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code completion using LSP and clangd
« Reply #367 on: March 13, 2024, 08:42:27 pm »
@ garwin

It looks like the problem is that neither Compiler nor Clangd_client can find the fully installed compiler.

How and where did you actually install (not copied) the mingw compiler?

How and where did you install (not copied) clangd?

Codeblocks find installed compiler as it compiles code without any problem.

MinGW 13.1
This version - https://github.com/brechtsanders/winlibs_mingw/releases/download/13.1.0-16.0.5-11.0.0-msvcrt-r5/winlibs-x86_64-posix-seh-gcc-13.1.0-mingw-w64msvcrt-11.0.0-r5.7z
copied to:
Codeblocks\MinGW 13.1

Compiler setup


Debugger setup


And it compiles correctly code from previous post.
Code
Output file is bin\Debug\TEST_CLANGD.exe with size 70.53 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 0 warning(s) (0 minute(s), 1 second(s))

Clangd
clangd.exe
msvcp140.dll
vcruntime140.dll
vceruntime140_1.dll

copied to:
Codeblocks\Clangd
which is setup in the plugin.



note: I have even tried to unzip whole LLMV-17.0.6.-win64.exe and set path to this clangd
« Last Edit: March 13, 2024, 09:18:49 pm by garwin »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Code completion using LSP and clangd
« Reply #368 on: March 13, 2024, 09:04:51 pm »
@ garwin
Are you opening the example program file from a <projectName>.cbp file or as a single c++ file?

Offline garwin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code completion using LSP and clangd
« Reply #369 on: March 13, 2024, 09:21:41 pm »
@Pecan

From the project cbp file or choosing a project from recent projects on the main codeblocks window.

It seems to me that clangd needs GCC standard library headers but cannot find them. But I have no idea how to tell Clangd where to find them, especially as they are in a lot of folders in MinGW.
I have tried to add to most of these directories in compiler search directories but it does not help.
« Last Edit: March 13, 2024, 09:32:47 pm by garwin »

Offline garwin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code completion using LSP and clangd
« Reply #370 on: March 13, 2024, 10:25:26 pm »
@Pecan

Find something but I do not know how to solve it. It mark MinGW directories as non-existent but they exist.
Trying run command:
Code
clangd --check=C:\Users\tnadrchal\Documents\_Ostatni\C++\TES
TS\_WORKING\TEST_CLANGD\TEST_CLANGD\main.cpp

Code
C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\Clangd>clangd --check=C:\Users\tnadrchal\Documents\_Ostatni\C++\TES
TS\_WORKING\TEST_CLANGD\TEST_CLANGD\main.cpp
I[22:18:09.957] clangd version 18.1.1
I[22:18:09.960] Features: windows
I[22:18:09.960] PID: 24384
I[22:18:09.961] Working directory: C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\Clangd
I[22:18:09.962] argv[0]: clangd.exe
I[22:18:09.963] argv[1]: --check=C:\Users\tnadrchal\Documents\_Ostatni\C++\TESTS\_WORKING\TEST_CLANGD\TEST_CLANGD\main.cpp
I[22:18:09.973] Entering check mode (no LSP server)
I[22:18:09.974] Testing on source file C:\Users\tnadrchal\Documents\_Ostatni\C++\TESTS\_WORKING\TEST_CLANGD\TEST_CLANGD\main.cpp
I[22:18:09.978] Loading compilation database...
I[22:18:09.995] Loaded compilation database from C:\Users\tnadrchal\Documents\_Ostatni\C++\TESTS\_WORKING\TEST_CLANGD\TEST_CLANGD\compile_commands.json
I[22:18:10.001] Compile command from CDB is: [C:/Users/tnadrchal/Documents/_Ostatni/C++/TESTS/_WORKING/TEST_CLANGD/TEST_CLANGD] "C:\\Users\\tnadrchal\\Documents\\_Ostatni\\C++\\CodeBlocks\\Clangd\\g++.exe" --driver-mode=g++ -Wall -fexceptions -v -g "-IC:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include" "-IC:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++" "-IC:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++/13.1.0" "-IC:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0/include" "-IC:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0" "-IC:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32" -IC:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/Clangd/include -c -o obj/Debug/main.o "-resource-dir=C:\\Users\\tnadrchal\\Documents\\_Ostatni\\C++\\CodeBlocks\\lib\\clang\\18" -- "C:\\Users\\tnadrchal\\Documents\\_Ostatni\\C++\\TESTS\\_WORKING\\TEST_CLANGD\\TEST_CLANGD\\main.cpp"
I[22:18:10.005] Parsing command...
clang version 18.1.1
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\Clangd
I[22:18:10.030] internal (cc1) args are: -cc1 -triple x86_64-pc-windows-msvc19.33.0 -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -gno-column-info -gcodeview -debug-info-kind=constructor -fdebug-compilation-dir=C:/Users/tnadrchal/Documents/_Ostatni/C++/TESTS/_WORKING/TEST_CLANGD/TEST_CLANGD -v -fcoverage-compilation-dir=C:/Users/tnadrchal/Documents/_Ostatni/C++/TESTS/_WORKING/TEST_CLANGD/TEST_CLANGD -resource-dir "C:\\Users\\tnadrchal\\Documents\\_Ostatni\\C++\\CodeBlocks\\lib\\clang\\18" -I "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include" -I "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++" -I "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++/13.1.0" -I "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0/include" -I "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0" -I "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32" -I C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/Clangd/include -internal-isystem "C:\\Users\\tnadrchal\\Documents\\_Ostatni\\C++\\CodeBlocks\\lib\\clang\\18\\include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 10.0/VC/include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 9.0/VC/include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 8/VC/include" -internal-isystem "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include" -Wall -fdeprecated-macro -ferror-limit 19 -fmessage-length=120 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.33 -std=c++14 -fskip-odr-check-in-gmf -fdelayed-template-parsing -fcxx-exceptions -fexceptions -no-round-trip-args -faddrsig -x c++ "C:\\Users\\tnadrchal\\Documents\\_Ostatni\\C++\\TESTS\\_WORKING\\TEST_CLANGD\\TEST_CLANGD\\main.cpp"
I[22:18:10.034] Building preamble...
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/Clangd/include"
ignoring nonexistent directory "C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\lib\clang\18\include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 10.0/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include"
#include "..." search starts here:
#include <...> search starts here:
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++/13.1.0
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0/include
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32
End of search list.
I[22:18:10.216] Built preamble of size 342244 for file C:\Users\tnadrchal\Documents\_Ostatni\C++\TESTS\_WORKING\TEST_CLANGD\TEST_CLANGD\main.cpp version null in 0.18 seconds
I[22:18:10.219] Indexing headers...
E[22:18:10.228] [pp_file_not_found] Line 1: in included file: 'bits/c++config.h' file not found
I[22:18:10.230] Building AST...
clang version 18.1.1
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\Clangd
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++/13.1.0"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0/include"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/Clangd/include"
ignoring nonexistent directory "C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\lib\clang\18\include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 10.0/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include"
#include "..." search starts here:
End of search list.
clang version 18.1.1
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\Clangd
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++/13.1.0"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0/include"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32"
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/Clangd/include"
ignoring nonexistent directory "C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\lib\clang\18\include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 10.0/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include"
#include "..." search starts here:
End of search list.
ignoring nonexistent directory "C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/Clangd/include"
ignoring nonexistent directory "C:\Users\tnadrchal\Documents\_Ostatni\C++\CodeBlocks\lib\clang\18\include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 10.0/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 9.0/VC/PlatformSDK/Include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/include"
ignoring nonexistent directory "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK/Include"
#include "..." search starts here:
#include <...> search starts here:
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/include/c++/13.1.0
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0/include
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32/13.1.0
 C:/Users/tnadrchal/Documents/_Ostatni/C++/CodeBlocks/MinGW 13.1/lib/gcc/x86_64-w64-mingw32
End of search list.
E[22:18:10.272] [no_member] Line 5: no member named 'cout' in namespace 'std'
E[22:18:10.273] [no_member] Line 5: no member named 'endl' in namespace 'std'
I[22:18:10.274] Indexing AST...
I[22:18:10.274] Building inlay hints
I[22:18:10.275] Building semantic highlighting
I[22:18:10.275] Testing features at each token (may be slow in large files)
I[22:18:10.278] All checks completed, 3 errors


Finding this discussion but quite late here, will look tomorrow.
This one - https://github.com/clangd/vscode-clangd/issues/393
And especially this one - https://clangd.llvm.org/faq#how-do-i-fix-errors-i-get-when-opening-headers-outside-of-my-project-directory - but how can I do it in codeblocks?
« Last Edit: March 13, 2024, 10:31:30 pm by garwin »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Code completion using LSP and clangd
« Reply #371 on: March 14, 2024, 12:18:41 am »
@garwin

Remove the space(s) in"....mingw 13.1/....
In other words, rename "Mingw 13.1" to Mingw13.1 (no space).

Do not use spaces in file or path names.
Bet it'll work after removing the spaces.

Important:
After removing the spaces in the paths,
delete the .cache directory in your project folder.
Delete the compile_commands.json file in your project folder before you load the project again.
This has to be done only once to remove the path names stored with spaces.

The reason why no spaces allowed. Clangd and friends are cross OS tools. And Unix derived tools cannot have spaces in files and paths.
« Last Edit: March 14, 2024, 06:09:56 am by Pecan »

Offline garwin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code completion using LSP and clangd
« Reply #372 on: March 14, 2024, 07:42:09 am »
@garwin

Remove the space(s) in"....mingw 13.1/....

Thanks a lot, that's it and adding everything to the search directory. I usually do not use spaces but for whatever unknown reasons I did it for the compiler version.

Offline garwin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Code completion using LSP and clangd
« Reply #373 on: March 15, 2024, 09:37:41 pm »
On Windows 11 opening the project file itself in Windows (not directly through Codeblocks) does not parse the project on opening. Reparsing is needed to be done manually. Doing so through Codeblocks works fine.
Steps to reproduce:
1. Codeblocks not running
2. Double-click on any project file *.cbp

On Plugin wiki https://wiki.codeblocks.org/index.php/CB_Clangd_Client the first link to the plugin repository page is not working.

For information, there is a discussion of doxygen support for Clangd - https://github.com/clangd/clangd/issues/529

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Code completion using LSP and clangd
« Reply #374 on: March 15, 2024, 11:21:58 pm »
On Windows 11 opening the project file itself in Windows (not directly through Codeblocks) does not parse the project on opening. Reparsing is needed to be done manually. Doing so through Codeblocks works fine.
Steps to reproduce:
1. Codeblocks not running
2. Double-click on any project file *.cbp

On Plugin wiki https://wiki.codeblocks.org/index.php/CB_Clangd_Client the first link to the plugin repository page is not working.

For information, there is a discussion of doxygen support for Clangd - https://github.com/clangd/clangd/issues/529

Thanks
The URL has been corrected. And thanks for the doxygen info.

I will see what I can do about DDE opened projects not being parsed automatically.
« Last Edit: March 15, 2024, 11:35:07 pm by Pecan »