Recent Posts

Pages: 1 2 3 4 [5] 6 7 8 9 10
41
Plugins development / Re: Code completion using LSP and clangd
« Last post by Pecan 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?
42
Plugins development / Re: Code completion using LSP and clangd
« Last post by garwin 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
43
Plugins development / Re: Code completion using LSP and clangd
« Last post by Pecan 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?
44
Plugins development / Re: Code completion using LSP and clangd
« Last post by garwin 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.




45
Plugins development / Re: Code completion using LSP and clangd
« Last post by Pecan 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.
46
General (but related to Code::Blocks) / Re: CB C++ Issue with GNU C++ 17 (ISO)
« Last post by Grit Clef on March 13, 2024, 11:59:38 am »
......
I am asking if my approach on simpling replacing the old compiler location with the new is OK, and to remove the run time error I possible need to re-compile the wx_Widgets libraries as a I have done previously. ?? This compile took some time.!

Regards JC......
As I experienced, you can try adding -jx to make command, where x represents the thread number of gcc called simultaneously, to take full advantages of CPU and speed up compilation. I can ensure that it'll take no more than 20 minutes to finish compiling wxWidgets.
47
Have you checked if your program finishes? Open task manager and check if console runner or your program are still alive.
48
General (but related to Code::Blocks) / Re: CB C++ Issue with GNU C++ 17 (ISO)
« Last post by nenin on March 13, 2024, 07:28:09 am »
The compiler error for C++ 17 (ISO) is gone.  But I now have a run time error involving wx_Widgets.  This is attached (I hope) and is a Entry Point Not Found in a wx*.dll.
I am asking if my approach on simpling replacing the old compiler location with the new is OK, and to remove the run time error I possible need to re-compile the wx_Widgets libraries as a I have done previously. ?? This compile took some time.!

Regards JC......
At my experience all linked C++ dlls should be build with the same compiler you are using for your application. So, you have to build you version of the wxWidgets or to use the same compiler as was used for these dlls.
Also there are strong reasons to avoid  install mingw in path with spaces.
49
General (but related to Code::Blocks) / Re: CB C++ Issue with GNU C++ 17 (ISO)
« Last post by jmClifford on March 13, 2024, 04:40:13 am »
and here:
https://github.com/niXman/mingw-builds-binaries/releases
In my humble opinion proper version is
x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev0.7z
Thank you for the above information.  I have downloaded a
x86_64-13.2.0-release-win32-seh-ucrt-rt_v11-rev1.7z unpacked it and loaded to
C:\Program Files\CodeBlocks\MinGW.
This is the very original location.  The compiler error for C++ 17 (ISO) is gone.  But I now have a run time error involving wx_Widgets.  This is attached (I hope) and is a Entry Point Not Found in a wx*.dll.
I am asking if my approach on simpling replacing the old compiler location with the new is OK, and to remove the run time error I possible need to re-compile the wx_Widgets libraries as a I have done previously. ?? This compile took some time.!

Regards JC......


50
Hello all,

Please bear with me - I am facing a really weird issue. I will try to be as exact as possible.

TL;DR - Compilation is successful only once, then every subsequent attempt (with any minor code change) fails with error (see below). Can only recompile if I manually go and delete .exe file (can do it as simple user, no need for elevated cmd). Running codeblocks as admin has same result. Antivirus is disabled. Fresh install CodeBlocks 20.03, MINGW64 bundle.

---

I am using a fresh install of CodeBlocks 20.03 (installed with the bundled MinGW64 compiler). OS is Windows 10 - 64bit.

I have been using Codeblocks without problem for 4-5 years now (version 17.12 - I just uninstalled and installed 20.03 trying to fix my proboem, but as I expected, it didn't work).

Suddenly, today, whenever I create a new file (just a simple File -> New -> Empty file), save it as test.c for example, write a simple hello world c program - when I compile it (or compile/run) everything works fine.

However, when I make any change to the code, for example change the printout to "hello world2", when trying to recompile I get:

||=== Build file: "no target" in "no project" (compiler: unknown) ===|
ld.exe||cannot open output file C:\tmp\test.exe Invalid argument|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

Settings -> Compiler -> ToolChain Executables shows correct path.

I googled around extensively for a solution ..

- I have my antivirus disabled, this cannot be an issue.
- I also searched for processes, both with task manager, and various powershell commands/applets that list all processes, sorted by datetime etc, could not really identify a process that 'stays alive' and causing problems as some people seem to suggest.
- I also stumbled accross a similar issue, described here, that talks about enabling an 'application experience' service in windows that could cause issues - no luck there, service is enabled in my system (as it should be)

Now, I finally found kind of a 'solution', or actually more a sign of what the problem is. If I manually go to a command prompt (not even an elevated one) and delete created .exe file, for example test.exe in the example above, then codeblocks can successfully compile (and run) the updated code, again only once though. Recompiling after a change gives the same error, and I have to manually delete new .exe file etc...

I have cleared my PATH environment because I had another version of GCC sitting there and thought this might (somehow?) create an issue..

I have tried to run Codeblocks as administrator just in case .. Exact same thing happens ..

The strange thing is that all this just happened 'randomly' - I mean I didn't change anything in windows or codeblocks .. It just happened today. Could it be a Windows update that messed something up?

Only thing I tried to do that might be relevant (although I cant understand how) is that I tried to setup VS Code to compile/run C programs - it did so successfully, but shows same behaviour - compiles and runs only once, then I have to go and manually delete .exe file in order for it to run again, and in VS code's case, I need an elevated prompt to delete the .exe .. I couldn't bother with that, and turned back to CodeBlocks (which I actually like to be honest) only to find this weird error here too.

Although it seems the vs code setup messed up things, I suspect it might be a coincidence, since I hadn't run CodeBlocks in some time, perhaps a windows update messed up something and I just had not been aware of it .. Maybe I 'm wrong and vs code did mess something up in my system..


Any help would be GREATLY appreciated .. I 've been fighting with this for4-5 hours now and really don't know what to do .. Unfortunately I don't have windows restore points, I would have tried that too.

Again pointing out that uninstall and fresh install of CodeBlocks 20.03 did nothing - it seems to be a weird OS issue? Codeblocks doesn't have the right to overwrite the .exe file created?


I would really appreciate any help and of course I m looking forward to any suggestions in order to try anything ..


thanks - sorry for the length of this message..


PS - I should point out that even successful compilation, still prints:

||=== Build file: "no target" in "no project" (compiler: unknown) ===|
||=== Build finished: 0 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

So I guess the 'compiler:unknown' is a "standard" message, although a bit weird - but that's not the problem.. Again I verify that settings->compiler->toolchain executables shows right path (and program compiles and runs (i see output) on first time OK, as well as every time I go and delete the .exe file...



I 'll add one more detail I just noticed, although this is way too big already..

If I only compile - then everything works fine. I mean, I can make changes to the code, and simply compile, everything is successful (no errors) and I see updated timestamps on .o object file, .exe and of course .c file. Problem starts happening as soon as I click 'run' even once on codeblocks - first time the program runs, terminal opens, I see output, but then every subsequent attempt to even simply compile (without even any changes) results in the aforementioned error.

Pages: 1 2 3 4 [5] 6 7 8 9 10