Author Topic: Completion suddenly stopped working  (Read 12562 times)

Offline questionderby

  • Multiple posting newcomer
  • *
  • Posts: 10
Completion suddenly stopped working
« on: June 23, 2021, 08:30:16 pm »
Hi! So I'm a beginner programmer, trying to learn C, and I picked Code::Blocks for this purpose. I'm on Void Linux, using Code::Blocks 20.03

I don't really understand the IDE yet, I'm trying to learn it. So I was trying to change the GTK theme to something dark so my eyes can rest. I changed $GTK_THEME for this purpose to Yaru:dark on my shell.

Code
GTK_THEME=Yaru:dark codeblocks

Just right after I launched codeblocks with this(and it worked btw, it was a dark theme), code completion suddenly stopped working. I looked around in the settings(editor, environment and whatnot) and couldn't find much about it. I also searched around a little on the internet, still no solutions :/

How do I go about fixing this little issue? Sorry if it's a simple thing and I wasted time on it, thanks for reading
« Last Edit: June 23, 2021, 09:20:42 pm by questionderby »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Completion suddenly stopped working
« Reply #1 on: June 23, 2021, 09:04:45 pm »
What do you mean by "doesn't work"? What doesn't work? Steps to reproduce? Can you reproduce it reliably?

You've provided four pieces of information in your post:
0. you're on x linux
1. you use 20.03
2. you've switch to dark theme
3. something you think it is called code completion doesn't work.

Given this information do you think we can help you?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline questionderby

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Completion suddenly stopped working
« Reply #2 on: June 23, 2021, 09:26:17 pm »
Well I'll be darned! What more can I give? Ask and I shall give the info.

I tried to reproduce it on another system (Knoppix), which didn't work, and the versions didn't match up.

On the install this happened, I press ctrl+space to complete code, and nothing for C shows up, unlike before (#include, #define, printf, for, while and such all appeared before this issue)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Completion suddenly stopped working
« Reply #3 on: June 24, 2021, 09:24:40 am »
Ctrl-space works for me, when the parser is doing OK, so I'm not reproducing this.

You've not given answers to most of these:
What do you mean by "doesn't work"? What doesn't work? Steps to reproduce? Can you reproduce it reliably?

You expect us to read your mind, but we cannot sorry.

Some more helping questions: Does this happen on a simple hello world project? Do you have the CC enabled in the settings? Is the CC plugin even loaded?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline questionderby

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Completion suddenly stopped working
« Reply #4 on: June 24, 2021, 10:11:52 am »
I'm sorry, I'm trying to give as much info as possible, I'm just too confused right now...

When I press ctrl+space, some stuff appears in code completion, but nothing related to C appears in the bar. No #include/#define, no <library.h>, no for/which, no variables that I created, nothing appears related to C code! This is only happening recently, I got C code completion at the beginning, and it started automatically, no need to press ctrl+space

I checked "Manage Plugins", I can see "Code Completion" there and yes it is enabled. It happens in both projects as well as just single C source files(*.c)... I tried a short hello world project now, no code completion for anything that is C. Hope these help.
« Last Edit: June 24, 2021, 12:50:16 pm by questionderby »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Completion suddenly stopped working
« Reply #5 on: June 24, 2021, 02:38:28 pm »
Works fine here...
Typing pri and I get a completion for printf.
Typing # gives me completions for #include, then typing < or " and ctrl-space gives me file completions.
Are you sure CC is enabled? You can check this in Settings -> Editor -> General -> Code Completion and Settings -> Editor -> Code completion.
You could probably also try --debug-log and then inspect if there is something which helps in the C::B Debug in logs&others.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline questionderby

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Completion suddenly stopped working
« Reply #6 on: June 24, 2021, 08:22:02 pm »
Okay I'm getting completions for #include, #define, and other preprocessors now, but that's about it.... The rest is not there.

I checked Plugins -> Manage Plugins... and saw "Code Completion" there, Version 1.0 Enabled: Yes, filename: libcodecompletion.so

I'll launch C::B with the said flag now and report back.

Edit: I launched codeblocks with --debug-log and looked at the messages on the terminal... I don't see much here

Code
 Warning: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1014,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1013,wx containers,compatible with 2.8).
Starting Code::Blocks Release 20.03  rev 11997 Apr  7 2020, 16:13:30 - wx3.0.4 - gcc 9.3.0 (Linux, unicode) - 64 bit
Manager initialized

(codeblocks:12662): Gtk-CRITICAL **: : gtk_tree_model_iter_nth_child: assertion 'n >= 0' failed

(codeblocks:12662): Gtk-CRITICAL **: : gtk_distribute_natural_allocation: assertion 'extra_space >= 0' failed

(codeblocks:12662): Gtk-WARNING **: : Negative content width -6 (allocation 1, extents 4x3) while allocating gadget (node toolbar, owner GtkToolbar)

(codeblocks:12662): Gtk-WARNING **: : Negative content width -6 (allocation 1, extents 4x3) while allocating gadget (node toolbar, owner GtkToolbar)

(codeblocks:12662): dconf-CRITICAL **: : unable to create file '/run/user/1000/dconf/user': Permission denied.  dconf will not work properly.

(codeblocks:12662): dconf-CRITICAL **: : unable to create file '/run/user/1000/dconf/user': Permission denied.  dconf will not work properly.

(codeblocks:12662): Gtk-CRITICAL **: : gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

(codeblocks:12662): Gtk-CRITICAL **:: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

(codeblocks:12662): Gtk-CRITICAL **: : gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar

(codeblocks:12662): Gtk-CRITICAL **: : gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar


I looked at the Code::Blocks Debug section at Logs&others and...

Code
Initialize EditColourSet .....
Initialize EditColourSet: done.
Loading menubar...
CodeStat: loaded
SmartIndentXML: loaded
OpenFilesList: loaded
HelpPlugin: loaded
ToolsPlus: loaded
lib_finder: loaded
IncrementalSearch: loaded
Exporter: loaded
ToDoList: loaded
HeaderFixup: loaded
HexEditor: loaded
AutoVersioning: loaded
Abbreviations: loaded
BrowseTracker: loaded
rndgen: loaded
FileManager: loaded
SymTab: loaded
EnvVars: loaded
wxSmithContribItems: loaded
CppCheck: loaded
NassiShneidermanPlugin: loaded
ReopenEditor: loaded
Valgrind: loaded
RegExTestbed: loaded
CodeCompletion: loaded
MouseSap: loaded
SmartIndentPython: loaded
copystrings: loaded
Compiler: loaded
OccurrencesHighlighting: loaded
DoxyBlocks: loaded
CodeSnippets: loaded
SmartIndentHDL: loaded
wxSmith: loaded
wxSmithMime: loaded
SmartIndentLua: loaded
cbDragScroll: loaded
SmartIndentFortran: loaded
BYOGames: loaded
Profiler: loaded
ProjectOptionsManipulator: loaded
SmartIndentCpp: loaded
Debugger: loaded
Cccc: loaded
ThreadSearch: loaded
SpellChecker: loaded
ProjectsImporter: loaded
EditorConfig: loaded
CB_Koders: loaded
EditorTweaks: loaded
Autosave: loaded
Cscope: loaded
AStylePlugin: loaded
cbKeyBinder: loaded
ClassWizard: loaded
wxSmithAui: loaded
FilesExtensionHandler: loaded
SmartIndentPascal: loaded
ScriptedWizard: loaded
Code statistics plugin activated
SmartIndentXML plugin activated
Open files list plugin activated
Help plugin plugin activated
ToolsPlus plugin activated
Library finder plugin activated
IncrementalSearch plugin activated
Source Exporter plugin activated
Todo List plugin activated
Header Fixup plugin activated
HexEditor plugin activated
AutoVersioning plugin activated
Abbreviations plugin activated
BrowseTracker plugin activated
rndgen plugin activated
FileManager plugin activated
Symbol Table Plugin plugin activated
Environment variables plugin activated
wxSmith - Contrib Items plugin activated
CppCheck plugin activated
NassiShneidermanPlugin plugin activated
ReopenEditor plugin activated
Valgrind plugin activated
Regular expressions testbed plugin activated
Code completion plugin activated
MouseSap plugin activated
SmartIndentPython plugin activated
Copy Strings to clipboard plugin activated
Added compiler "GNU GCC Compiler"
Added compiler "Intel C/C++ Compiler"
Added compiler "GDC D Compiler"
Added compiler "GNU Fortran Compiler"
Added compiler "G95 Fortran Compiler"
Added compiler "GNU GCC Compiler for ARM"
Added compiler "GNU GCC Compiler for Android"
Added compiler "LLVM Clang Compiler"
Added compiler "GNU GCC Compiler for ZPU"
Added compiler "Small Device C Compiler"
Added compiler "GNU GCC Compiler for Blackfin"
Added compiler "Digital Mars D Compiler"
Added compiler "PGI Fortran Compiler"
Added compiler "GNU GCC Compiler for MSP430 (HighTec)"
Added compiler "GNU GCC Compiler for LM32"
Added compiler "LLVM D Compiler"
Added compiler "GNU GCC Compiler for AVR"
Added compiler "GNU GCC Compiler for TriCore (HighTec)"
Added compiler "GNU GCC Compiler for LM8"
Added compiler "GNU GCC Compiler for PowerPC (HighTec)"
Added compiler "Tiny C Compiler"
Added compiler "*No Compiler*"
Added compiler "GNU GCC Compiler for PowerPC EABI"
Master path of compiler ID "gcc" is empty -> triggers auto-detection.
Compiler plugin activated
OccurrencesHighlighting plugin activated
DoxyBlocks plugin activated
Code snippets plugin activated
SmartIndentHDL plugin activated
wxSmith plugin activated
wxSmith - MIME plugin plugin activated
SmartIndentLua plugin activated
DragScroll plugin activated
SmartIndentFortran plugin activated
BYO Games plugin activated
Code profiler plugin activated
Project options manipulator plugin activated
SmartIndentCpp plugin activated
Debugger plugin activated
Cccc plugin activated
ThreadSearch plugin activated
Loading image: '/usr/share/codeblocks/SpellChecker/16x16/disabled.png' succeeded!
SpellChecker plugin activated
Foreign projects importer plugin activated
EditorConfig plugin for Code::Blocks plugin activated
Koders query plugin activated
Editor Tweaks plugin: Building menu
Editor Tweaks plugin: making the menu 15
Editor Tweaks plugin: Folding menu
EditorTweaks plugin activated
Autosave plugin activated
Cscope plugin activated
Source code formatter (AStyle) plugin activated
Keyboard shortcuts plugin activated
Class wizard plugin activated
wxSmith - Aui plugin activated
Files extension handler plugin activated
SmartIndentPascal plugin activated
Project wizard added for 'Empty project'
Project wizard added for 'Fortran application'
Project wizard added for 'Fortran library'
Project wizard added for 'Fortran DLL'
Project wizard added for 'Console application'
Project wizard added for 'D application'
Project wizard added for 'FLTK project'
Project wizard added for 'GLFW project'
Project wizard added for 'GLUT project'
Project wizard added for 'GTK+ project'
Project wizard added for 'Irrlicht project'
Project wizard added for 'Java application'
Project wizard added for 'Lightfeather project'
Project wizard added for 'Matlab project'
Project wizard added for 'OpenCV project'
Project wizard added for 'OpenGL project'
Project wizard added for 'Ogre project'
Project wizard added for 'Code::Blocks plugin'
Project wizard added for 'QT4 project'
Project wizard added for 'QT4 (shared) project'
Project wizard added for 'QT5 project'
Project wizard added for 'SDL project'
Project wizard added for 'SDL2 project'
Project wizard added for 'SFML project'
Project wizard added for 'Static library'
Project wizard added for 'Shared library'
Project wizard added for 'wxWidgets project'
Build-target wizard added for 'Console'
Build-target wizard added for 'Static library'
Build-target wizard added for 'wxWidgets'
Project wizard added for 'Arduino Project'
Project wizard added for 'ARM Project'
Project wizard added for 'AVR Project'
Project wizard added for 'MSP430 Project'
Project wizard added for 'TriCore Project'
Project wizard added for 'PowerPC Project'
Project wizard added for 'MCS51 Project'
File(s) wizard added for 'Empty file'
File(s) wizard added for 'C/C++ source'
File(s) wizard added for 'D source'
File(s) wizard added for 'C/C++ header'
File(s) wizard added for 'Fortran source'
File(s) wizard added for 'Java source'
Scripted wizard plugin activated
Loading toolbar...
Initializing plugins...
Mozilla universal detection engine detected 'Pure *ASCII*'.
Final encoding detected: Unicode 8 bit (UTF-8) (ID: 43)
Editor Open
NativeParser::SafeExecute: Invalid application command: g++
NativeParser::SafeExecute: Invalid application command: g++
NativeParser::DoFullParsing: AddCompilerPredefinedMacros failed!
NativeParser::DoFullParsing: Adding cpp/c files to batch-parser
NativeParser::CreateParser: Finish creating a new parser for project '*NONE*'
NativeParser::OnParserStart: Starting batch parsing for project '*NONE*'...
SystemHeadersThread: Start traversing: /home/user1/C/
SystemHeadersThread: Traversing /home/user1/C/ finished, found 2 headers; time: 0.000 sec
SystemHeadersThread: Total number of paths: 1
NativeParser::OnParserEnd: Project '*NONE*' parsing stage done!
Project '*NONE*' parsing stage done (0 total parsed files, 0 tokens in 0 minute(s), 0.060 seconds).
Reparsing when typing for editor /home/user1/C/t.c
NativeParser::OnParserStart: Starting re-parsing for project '*NONE*'...
Project '*NONE*' parsing stage done (1 total parsed files, 0 tokens in 0 minute(s), 0.000 seconds).
Reparsing when typing for editor /home/user1/C/t.c
NativeParser::OnParserStart: Starting re-parsing for project '*NONE*'...
Project '*NONE*' parsing stage done (1 total parsed files, 0 tokens in 0 minute(s), 0.000 seconds).
Reparsing when typing for editor /home/user1/C/t.c
NativeParser::OnParserStart: Starting re-parsing for project '*NONE*'...
Project '*NONE*' parsing stage done (1 total parsed files, 1 tokens in 0 minute(s), 0.006 seconds).
Reparsing when typing for editor /home/user1/C/t.c
NativeParser::OnParserStart: Starting re-parsing for project '*NONE*'...
Project '*NONE*' parsing stage done (1 total parsed files, 1 tokens in 0 minute(s), 0.000 seconds).
Reparsing when typing for editor /home/user1/C/t.c
NativeParser::OnParserStart: Starting re-parsing for project '*NONE*'...
Project '*NONE*' parsing stage done (1 total parsed files, 1 tokens in 0 minute(s), 0.000 seconds).

I still don't get why code completion disappeared suddenly

I checked Settings -> Editor -> General and saw "Code Completion" checked there, and I don't know what to look for exactly in Settings -> Editor -> Code Completion
« Last Edit: June 24, 2021, 08:40:49 pm by questionderby »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Completion suddenly stopped working
« Reply #7 on: June 24, 2021, 08:40:16 pm »
Why do you think these are not important?
Are you using a non GCC compiler?

Code
NativeParser::SafeExecute: Invalid application command: g++
NativeParser::SafeExecute: Invalid application command: g++
NativeParser::DoFullParsing: AddCompilerPredefinedMacros failed!

And, this raises concern to me, also. But, I think it is not related to you Code Completion issue.
Code
Warning: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1014,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1013,wx containers,compatible with 2.8).

Tim S.
« Last Edit: June 24, 2021, 08:44:27 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline questionderby

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Completion suddenly stopped working
« Reply #8 on: June 24, 2021, 08:41:36 pm »
I don't even have anything other than GCC, so no

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Completion suddenly stopped working
« Reply #9 on: June 24, 2021, 08:46:19 pm »
I don't even have anything other than GCC, so no

Build and run a simple hello world project to verify GCC is working.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline questionderby

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Completion suddenly stopped working
« Reply #10 on: June 24, 2021, 08:46:45 pm »
And, this raises concern to me, also. But, I think it is not related to you Code Completion issue.
Code
Warning: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1014,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1013,wx containers,compatible with 2.8).

Tim S.

For some reason I see that on every Linux OS I used for now(Arch, Void, Ubuntu etc.)
« Last Edit: June 24, 2021, 10:17:22 pm by questionderby »

Offline questionderby

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Completion suddenly stopped working
« Reply #11 on: June 24, 2021, 08:49:27 pm »
I've made quite a simple file:

Code
cat hi.c
#include <stdio.h>

main()
{
printf("Hello!\n");
}

Code
gcc hi.c
hi.c:3:1: warning: return type defaults to 'int' [-Wimplicit-int]
    3 | main()
      | ^~~~

Code
./a.out 
Hello!

Doesn't look like anything is wrong...

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Completion suddenly stopped working
« Reply #12 on: June 24, 2021, 11:33:22 pm »
Do you have g++ installed?
You built using gcc. On Linux you can only install gcc sometimes.

Tim S.

 
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline questionderby

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Completion suddenly stopped working
« Reply #13 on: June 25, 2021, 10:07:42 am »
Do you have g++ installed?
You built using gcc. On Linux you can only install gcc sometimes.

Tim S.

I mean...

Code
g++ --version
g++ (GCC) 10.2.1 20201203
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Code
g++ hi.c
hi.c:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    3 | main()
      | ^~~~

Code
./a.out 
Hello!

I really don't want to find another IDE just for code completion... This one's too good to give up
« Last Edit: June 25, 2021, 10:30:51 am by questionderby »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Completion suddenly stopped working
« Reply #14 on: June 25, 2021, 12:03:40 pm »
Does anyone know if you need a CB project for Code Completion to work?

The OP may or may not be using a project.

I give up on helping the OP; since, I am not on Linux or use CC much no more can I do.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org