Author Topic: Code Completion only works for "::" ? (CB 8.02, Ubuntu 8.04)  (Read 6793 times)

Offline chca

  • Single posting newcomer
  • *
  • Posts: 5

Hello,

I want to use Code::Blocks 8.02 on Ubuntu 8.04 (64-bit) and installed the official .deb-file (http://www.codeblocks.org/downloads/5). When I create an "empty project", add a file "test.cpp" and type this code:

Code
struct Foo
{
int mNumber;
};

void main()
{
Foo f;
// my cursor is here ...
}

"Foo::" will show a popup with "mNumber", but "f." won't. With "Foo* f" and "f->" it's just the same. When I use include files, classes, etc. code completion also only works with "::".

My code completion settings:
* "Disable code-completion" unchecked
* "Disable SmartSense" unchecked
* "Case sensitive matches" checked
* "Display info when hovering ..." checked
* "Auto-select, if only one match" unchecked
* "Automatically launch when ..." checked, number is "4"
* "Maximum allowed code-completion matches" 16384
* "Fillup characters" (empty)
* "Keyword sets to additionally include" 1+2 checked, 3-9 unchecked
* "Delay for auto-kick-in when typing [. :: ->]" 500 ms

I tested the example on a different PC using Ubuntu 7.10 (32-bit) with the same result.

Thanks for any advice.

chca

Offline Ganbito

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Code Completion only works for "::" ? (CB 8.02, Ubuntu 8.04)
« Reply #1 on: May 07, 2008, 11:50:26 pm »
I had the same problem a few days ago with autocompletion of the wxWidget clases. Searching throw this forum I have found the solution.

Code::Blocks has a Search path for autocompletion, so you have to add the path of your "test.cpp" to that Search path.

Where is it?

Go to menu Settings->Compiler and debugger... and in the opened window: Global compiler settings->Search directories->Linker.

Click the "Add" button to add the path of your "test.cpp" and it should work.

I have tried this before posting here on Code::Blocks 8.02 on Ubuntu 8.04 64 bits (the same as yours) and it works fine for me.

Offline Barking_Mad

  • Multiple posting newcomer
  • *
  • Posts: 47
Re: Code Completion only works for "::" ? (CB 8.02, Ubuntu 8.04)
« Reply #2 on: May 08, 2008, 12:47:31 am »
also helps to hit ctrl-s for save, seems to update the auto-completion thingy.
WooF! WooF! - Ubuntu 8.10 & CB 5432 & GCC 4.3.2
To see the world in a grain of sand and heaven in a wild flower
To hold infinity in the palm of your hand and eternity in an hour - W.B

Offline chca

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code Completion only works for "::" ? (CB 8.02, Ubuntu 8.04)
« Reply #3 on: May 08, 2008, 12:33:14 pm »
@Ganbito: I can't imagine that Code::Blocks doesn't know where to find the files in the current project for parsing. And I doubt that it is useful to add a source path to the linker path list (do you mean "Project Properties -> C/C++ parser options -> Additional search paths"?). Nevertheless, I added "test.cpp" to both paths, but nothing changes.

@Barking_Mad: Saving does not work for me. Even not saving and restarting Code::Blocks.

The problem certainly is not that Code::Blocks doesn't find my symbols (due to bad path setup); the "::" operator shows a complete list of all members, so basically everything is parsed (even in wxwidgets projects, etc.). Just "." and "->" do not show the member list.

Offline Ganbito

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Code Completion only works for "::" ? (CB 8.02, Ubuntu 8.04)
« Reply #4 on: May 08, 2008, 03:27:46 pm »
@chca: Like you, I can't image that, but I have tested that it works in that way.

Well, that you write "Project Properties -> C/C++ parser options -> Additional search paths" seems more apropiated for files within a project, but when I wrote I only remember global properties.

I meant path where "test.cpp" is found, not "test.cpp" itself, but when I wish to try that (during the writing of this post) it get working in the right way even without adding the related path to the Search path (even global or project settings) so I have no idea, but now it works as it was thinked to work. I deleted the previous global search path, started a new project and changed the struct name (struct Glass...) but it continued to work, so I don't know.  :?

Sorry, but I can't try to help you anymore.

Offline chca

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code Completion only works for "::" ? (CB 8.02, Ubuntu 8.04)
« Reply #5 on: May 08, 2008, 07:13:33 pm »
Of course, I added the path and not the file; sorry for my inaccurate statement.

I've build Code::Blocks from source, but the same problem again.

Very interesting: With global variables, "." and "->" work fine (local variables in functions and member variables in classes don't work):

Code
struct Foo
{
    int mNumber;
};

Foo f1;

int main()
{
    Foo f2;
    // cursor is here
    return 0;
}

Code
struct Foo
{
    int mNumber;
};

Foo f1;

class A
{
    private:
        Foo f2;

    public:
        void test();
};

void A::test()
{
    // cursor is here
}


So "f1." will show the list, but "f2." won't. Very strange.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Code Completion only works for "::" ? (CB 8.02, Ubuntu 8.04)
« Reply #6 on: May 08, 2008, 08:30:01 pm »
So "f1." will show the list, but "f2." won't. Very strange.
...not for me (see the image below).



Could you try one of the next nightlies? Probably this "bug" has been fixed. (There were quite some changes to CC... actually not related to your issue... but... who knows?! ;-)).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline chca

  • Single posting newcomer
  • *
  • Posts: 5
Re: Code Completion only works for "::" ? (CB 8.02, Ubuntu 8.04)
« Reply #7 on: May 12, 2008, 10:37:25 am »
I checked out the latest svn version (5041), but there is no improvement. In order to find out if it has something to do with my ubuntu installation, I made a fresh install in a virtual machine (Ubuntu 8.04, 64 bit, DVD image) and installed nothing but
- all available security updates
- libwxgtk2.8-0 libwxgtk2.8-dev wx-common wx-i18n wx2.8-headers (and dependencies)
- g++ (and dependencies)
- codeblocks debs from codeblocks-8.02-amd64.tar.gz

Unfortunately, the issue is exactly the same as described above. What's wrong with my setup?

tagra123

  • Guest
Re: Code Completion only works for "::" ? (CB 8.02, Ubuntu 8.04)
« Reply #8 on: June 18, 2008, 04:23:25 pm »
Something that I've found to work when creating a new project is to save everything then close codeblocks, and then when the project is reopened in codeblocks the code completion works.  I didn't modify anything as suggested above. F1 and F2 still do nothing but after typing 4 characters the code completion kicks in the same way it does when using windows.


Starting it with a command prompt and try to complete code -- I also pushed f1 and f2 which created the following output but upon reopening everything seems to work correctly.  When F2 was pressed it crashed.


WHEN IT DIDNT WORK
Code
yourusername@yourmachinename:~$ codeblocks
Initialize EditColourSet .....
Initialize EditColourSet: done.
Loading toolbar...
Exporter: loaded
ToDoList: loaded
HelpPlugin: loaded
ProjectsImporter: loaded
SymTab: loaded
BYOGames: loaded
CodeStat: loaded
AStylePlugin: loaded
wxSmithContribItems: loaded
EnvVars: loaded
OpenFilesList: loaded
CB_Koders: loaded
Profiler: loaded
wxSmith: loaded
wxSmithMime: loaded
ClassWizard: loaded
Autosave: loaded
ThreadSearch: loaded
CodeCompletion: loaded
ScriptedWizard: loaded
cbKeyBinder: loaded
AutoVersioning: loaded
BrowseTracker: loaded
RegExTestbed: loaded
Compiler: loaded
cbDragScroll: loaded
Debugger: loaded
lib_finder: loaded
CodeSnippets: loaded
FilesExtensionHandler: loaded
Source Exporter plugin activated
To-Do List plugin activated
Help plugin plugin activated
Foreign projects importer plugin activated
Symbol Table Plugin plugin activated
BYO Games plugin activated
Code statistics plugin activated
Source code formatter (AStyle) plugin activated
wxSmith - Contrib Items plugin activated
Environment variables plugin activated
Open files list plugin activated
Koders query plugin activated
Code profiler plugin activated
wxSmith plugin activated
wxSmith - MIME plugin plugin activated
Class wizard plugin activated
Autosave plugin activated
ThreadSearch plugin activated
Code completion plugin activated
Project wizard added for 'Empty project'
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 'Lightfeather 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 'SDL project'
Project wizard added for 'Static library'
Project wizard added for 'Shared library'
Project wizard added for 'AVR Project'
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'
File(s) wizard added for 'Empty file'
File(s) wizard added for 'C/C++ source'
File(s) wizard added for 'C/C++ header'
Scripted wizard plugin activated
Keyboard shortcuts plugin activated
AutoVersioning plugin activated
BrowseTracker plugin activated
Regular expressions testbed plugin activated
Added compiler "GNU GCC Compiler"
Parsing stage done (0 total parsed files, 0 tokens in 0 minute(s), 0.0 seconds).
Updating class browser...
Class browser updated.
Added compiler "Intel C/C++ Compiler"
Added compiler "SDCC Compiler"
Added compiler "Tiny C Compiler"
Added compiler "GDC D Compiler"
Added compiler "Digital Mars D Compiler"
Added compiler "GNU ARM GCC Compiler"
Added compiler "GNU AVR GCC Compiler"
Added compiler "GNU GCC Compiler for PowerPC"
Added compiler "GNU GCC Compiler for TriCore"
Compiler plugin activated
DragScroll plugin activated
Debugger plugin activated
Library finder plugin activated
Code snippets plugin activated
Files extension handler plugin activated
Initializing plugins...
KeyBinder failed UpdateById on[691][CR & LF]
KeyBinder failed UpdateById on[1950][Debugging]
KeyBinder failed UpdateById on[195][Edit file types & categories...]
Add project test in parsing queue
Caching internal gcc dirs for adding to parser...
Caching GCC dir: /usr/include/c++/4.2
Caching GCC dir: /usr/include/c++/4.2/i486-linux-gnu
Caching GCC dir: /usr/include/c++/4.2/backward
Caching GCC dir: /usr/local/include
Caching GCC dir: /usr/lib/gcc/i486-linux-gnu/4.2.3/include
Caching GCC dir: /usr/include
Generated file /home/yourusername/A_CB_TEST/test/testApp.h
Project's base path: /home/yourusername/A_CB_TEST/test/
Project's common toplevel path: /home/yourusername/A_CB_TEST/test/
Generated file /home/yourusername/A_CB_TEST/test/testApp.cpp
Generated file /home/yourusername/A_CB_TEST/test/testMain.h
Generated file /home/yourusername/A_CB_TEST/test/testMain.cpp
Generated file /home/yourusername/A_CB_TEST/test/wxsmith/testdialog.wxs
found /home/yourusername/A_CB_TEST/test/testMain.cpp
Reparsing saved files...
Starting batch parsing
Parsing stage done (6 total parsed files, 22 tokens in 0 minute(s), 0.65 seconds).
Updating class browser...
Class browser updated.
Reparsing saved files...
Starting batch parsing
Parsing stage done (6 total parsed files, 21 tokens in 0 minute(s), 0.7 seconds).
Updating class browser...
Class browser updated.
*** glibc detected *** codeblocks: corrupted double-linked list: 0x09291840 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb686c0cd]
/lib/tls/i686/cmov/libc.so.6[0xb686dedd]
/lib/tls/i686/cmov/libc.so.6[0xb686f55a]
/lib/tls/i686/cmov/libc.so.6(realloc+0x10b)[0xb687175b]
/usr/lib/libfontconfig.so.1[0xb798d03c]
/usr/lib/libfontconfig.so.1[0xb798d331]
/usr/lib/libfontconfig.so.1[0xb798d375]
/usr/lib/libfontconfig.so.1[0xb798de77]
/usr/lib/libfontconfig.so.1(FcFontSetSort+0x480)[0xb7996280]
/usr/lib/libfontconfig.so.1(FcFontSort+0x58)[0xb7996488]
/usr/lib/libpangoft2-1.0.so.0[0xb67dcf26]
/usr/lib/libpango-1.0.so.0(pango_font_map_load_fontset+0x50)[0xb7aab3f0]
/usr/lib/libpango-1.0.so.0[0xb7aa91f7]
/usr/lib/libpango-1.0.so.0(pango_itemize_with_base_dir+0x8d)[0xb7aa95dd]
/usr/lib/libpango-1.0.so.0[0xb7ab26a0]
/usr/lib/libpango-1.0.so.0[0xb7ab3a6d]
/usr/lib/libgtk-x11-2.0.so.0[0xb7cf718a]
/usr/lib/libwx_gtk2u_core-2.8.so.0(_ZNK12wxStaticText13DoGetBestSizeEv+0x78)[0xb6df4c48]
/usr/lib/libwx_gtk2u_core-2.8.so.0(_ZNK12wxWindowBase19GetEffectiveMinSizeEv+0x92)[0xb6e953a2]
/usr/lib/libwx_gtk2u_core-2.8.so.0(_ZN11wxSizerItem7CalcMinEv+0x62)[0xb6e81bd2]
/usr/lib/libwx_gtk2u_core-2.8.so.0(_ZN10wxBoxSizer7CalcMinEv+0x9d)[0xb6e812dd]
/usr/lib/libwx_gtk2u_core-2.8.so.0(_ZN7wxSizer10GetMinSizeEv+0x1e)[0xb6e8005e]
/usr/lib/libwx_gtk2u_core-2.8.so.0(_ZN7wxSizer16GetMinWindowSizeEP8wxWindow+0x2c)[0xb6e82e6c]
/usr/lib/libwx_gtk2u_core-2.8.so.0(_ZN7wxSizer3FitEP8wxWindow+0x2d)[0xb6e82f1d]
/usr/lib/libwx_gtk2u_xrc-2.8.so.0(_ZN17wxSizerXmlHandler12Handle_sizerEv+0x391)[0xb7196f51]
/usr/lib/libwx_gtk2u_xrc-2.8.so.0(_ZN17wxSizerXmlHandler16DoCreateResourceEv+0x7a)[0xb719701a]
/usr/lib/libwx_gtk2u_xrc-2.8.so.0(_ZN20wxXmlResourceHandler14CreateResourceEP9wxXmlNodeP8wxObjectS3_+0x1b5)[0xb71b1815]
/usr/lib/libwx_gtk2u_xrc-2.8.so.0(_ZN13wxXmlResource17CreateResFromNodeEP9wxXmlNodeP8wxObjectS3_P20wxXmlResourceHandler+0x470)[0xb71b69d0]
/usr/lib/libwx_gtk2u_xrc-2.8.so.0(_ZN20wxXmlResourceHandler14CreateChildrenEP8wxObjectb+0x137)[0xb71b6d47]
/usr/lib/libwx_gtk2u_xrc-2.8.so.0(_ZN18wxDialogXmlHandler16DoCreateResourceEv+0x499)[0xb71751f9]
/usr/lib/libwx_gtk2u_xrc-2.8.so.0(_ZN20wxXmlResourceHandler14CreateResourceEP9wxXmlNodeP8wxObjectS3_+0x1b5)[0xb71b1815]
/usr/lib/libwx_gtk2u_xrc-2.8.so.0(_ZN13wxXmlResource17CreateResFromNodeEP9wxXmlNodeP8wxObjectS3_P20wxXmlResourceHandler+0x470)[0xb71b69d0]
/usr/lib/libwx_gtk2u_xrc-2.8.so.0(_ZN13wxXmlResource10LoadDialogEP8wxDialogP8wxWindowRK8wxString+0x83)[0xb71b80c3]
codeblocks[0x807327a]
codeblocks(_ZN9MainFrame26OnSettingsCompilerDebuggerER14wxCommandEvent+0x32)[0x80864f2]
/usr/lib/libwx_baseu-2.8.so.0(_ZNK12wxAppConsole11HandleEventEP12wxEvtHandlerMS0_FvR7wxEventES3_+0x41)[0xb6ad60e1]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler21ProcessEventIfMatchesERK21wxEventTableEntryBasePS_R7wxEvent+0x88)[0xb6b7db88]
/usr/lib/libwx_baseu-2.8.so.0(_ZN16wxEventHashTable11HandleEventER7wxEventP12wxEvtHandler+0x78)[0xb6b7dce8]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0xbf)[0xb6b7de4f]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProcessEventER7wxEvent+0x6b)[0xb6b7ddfb]
/usr/lib/libwx_baseu-2.8.so.0(_ZN12wxEvtHandler12ProAborted



WHEN IT DID WORK
Code
yourusername@yourmachinename:~$ codeblocks
Initialize EditColourSet .....
Initialize EditColourSet: done.
Loading toolbar...
Exporter: loaded
ToDoList: loaded
HelpPlugin: loaded
ProjectsImporter: loaded
SymTab: loaded
BYOGames: loaded
CodeStat: loaded
AStylePlugin: loaded
wxSmithContribItems: loaded
EnvVars: loaded
OpenFilesList: loaded
CB_Koders: loaded
Profiler: loaded
wxSmith: loaded
wxSmithMime: loaded
ClassWizard: loaded
Autosave: loaded
ThreadSearch: loaded
CodeCompletion: loaded
ScriptedWizard: loaded
cbKeyBinder: loaded
AutoVersioning: loaded
BrowseTracker: loaded
RegExTestbed: loaded
Compiler: loaded
cbDragScroll: loaded
Debugger: loaded
lib_finder: loaded
CodeSnippets: loaded
FilesExtensionHandler: loaded
Source Exporter plugin activated
To-Do List plugin activated
Help plugin plugin activated
Foreign projects importer plugin activated
Symbol Table Plugin plugin activated
BYO Games plugin activated
Code statistics plugin activated
Source code formatter (AStyle) plugin activated
wxSmith - Contrib Items plugin activated
Environment variables plugin activated
Open files list plugin activated
Koders query plugin activated
Code profiler plugin activated
wxSmith plugin activated
wxSmith - MIME plugin plugin activated
Class wizard plugin activated
Autosave plugin activated
ThreadSearch plugin activated
Code completion plugin activated
Project wizard added for 'Empty project'
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 'Lightfeather 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 'SDL project'
Project wizard added for 'Static library'
Project wizard added for 'Shared library'
Project wizard added for 'AVR Project'
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'
File(s) wizard added for 'Empty file'
File(s) wizard added for 'C/C++ source'
File(s) wizard added for 'C/C++ header'
Scripted wizard plugin activated
Keyboard shortcuts plugin activated
AutoVersioning plugin activated
BrowseTracker plugin activated
Regular expressions testbed plugin activated
Added compiler "GNU GCC Compiler"
Parsing stage done (0 total parsed files, 0 tokens in 0 minute(s), 0.0 seconds).
Updating class browser...
Class browser updated.
Added compiler "Intel C/C++ Compiler"
Added compiler "SDCC Compiler"
Added compiler "Tiny C Compiler"
Added compiler "GDC D Compiler"
Added compiler "Digital Mars D Compiler"
Added compiler "GNU ARM GCC Compiler"
Added compiler "GNU AVR GCC Compiler"
Added compiler "GNU GCC Compiler for PowerPC"
Added compiler "GNU GCC Compiler for TriCore"
Compiler plugin activated
DragScroll plugin activated
Debugger plugin activated
Library finder plugin activated
Code snippets plugin activated
Files extension handler plugin activated
Initializing plugins...
Loading project file...
Parsing project file...
Loading target Debug
Loading target Release
Loading project files...
5 files loaded
Done loading project in 115ms
Project's base path: /home/yourusername/A_CB_TEST/test1/
Project's common toplevel path: /home/yourusername/A_CB_TEST/test1/
project data set for /home/yourusername/A_CB_TEST/test1/test1Main.cpp
Add project test1 in parsing queue
Caching result of `wx-config --cflags`
Cached
Caching result of `wx-config --libs`
Cached
Caching internal gcc dirs for adding to parser...
Caching GCC dir: /usr/include/c++/4.2
Caching GCC dir: /usr/include/c++/4.2/i486-linux-gnu
Caching GCC dir: /usr/include/c++/4.2/backward
Caching GCC dir: /usr/local/include
Caching GCC dir: /usr/lib/gcc/i486-linux-gnu/4.2.3/include
Caching GCC dir: /usr/include
Passing list of files to parse
Starting batch parsing
Parsing stage done (285 total parsed files, 15347 tokens in 0 minute(s), 4.827 seconds).
Updating class browser...
Class browser updated.
« Last Edit: June 18, 2008, 04:41:15 pm by tagra123 »