Author Topic: linux, code completion  (Read 15365 times)

Offline D101101

  • Single posting newcomer
  • *
  • Posts: 7
linux, code completion
« on: October 23, 2013, 02:00:56 pm »
Hello

I like how code completion in Windows works, but in Ubuntu ppa it's not completely included.
For example, when adding SDL library and writing the beginning of the name of SDL_... function in Windows, possible functions list appears on the screen.
how do i turn this fuction on in CB?(build from source code with same flags???)

ToApolytoXaos

  • Guest
Re: linux, code completion
« Reply #1 on: October 23, 2013, 03:29:17 pm »
For example, when adding SDL library and writing the beginning of the name of SDL_... function in Windows, possible functions list appears on the screen.
Just to let you know, I have noticed the same behavior on my GNU / Debian testing machine and for some reason autocompletion does not parse properly. I'm compiling C::B myself always with the latest revision and indeed there are moments where I get really irritated by the mechanism with how it "forces" me to reparse the entire project.

Nevertheless, it's a minor issue as it parses the project on the background which eventually makes it possible to use again autocompletion. Usually I safe the project, then press Ctrl+F11 to rebuild the project, run it, and then check the autocompletion mechanism. After all this fuss, it works normally.

Offline D101101

  • Single posting newcomer
  • *
  • Posts: 7
Re: linux, code completion
« Reply #2 on: October 24, 2013, 07:10:51 pm »
Sorry my English isn't very good. I'm not sure you understood me correctly.
I meant this
Linux:

Windows:


Linux:

Windows:


Linux:

Windows:

ToApolytoXaos

  • Guest
Re: linux, code completion
« Reply #3 on: October 24, 2013, 07:25:17 pm »
The Linux version you are using, is it older than 12.11 if you use stable? Are you using nightly builds?
[NOTE]: OK, I have see that your Windows version is 12.11, but I want to know what kind of version you are using under Linux.

It would be a lot more helpful for us, if you could provide more information so I could you help a bit now that I have time.

Also, go to Settings > Editor > Code Completion and check the options over there. You might have disabled code completion by mistake.
« Last Edit: October 24, 2013, 07:28:00 pm by ToApolytoXaos »

Offline D101101

  • Single posting newcomer
  • *
  • Posts: 7
Re: linux, code completion
« Reply #4 on: October 24, 2013, 08:57:02 pm »
svn build rev 9156 (2013-06-13 14:35:53) gcc 4.6.3 Linux/unicode - 64 bit
install from pasgui/ppa
settings by default


it's working on class, struct and my header files

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: linux, code completion
« Reply #5 on: October 24, 2013, 09:57:19 pm »
What Ubuntu version?

I have no  such problems on Ubuntu 12.04 and 13.10. It may not make a difference but you can try my PPA which is updated daily.

Have you verified that your code compiles? If the standard headers are somehow messed up this might explain the problem.

Otherwise maybe locale/encoding issues?
« Last Edit: October 24, 2013, 11:39:09 pm by dmoore »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: linux, code completion
« Reply #6 on: October 24, 2013, 10:02:04 pm »
Also, try running from command line with

Code
codeblocks --debug-log

After you open a project, the debug log should have output like

Code
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/c++/4.6
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/c++/4.6/i686-linux-gnu
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/c++/4.6/backward
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/lib/gcc/i686-linux-gnu/4.6/include
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/local/include
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/i386-linux-gnu
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include
NativeParser::DoFullParsing(): AddCompilerPredefinedMacros failed!
NativeParser::DoFullParsing(): Adding three kind of files to batch-parser
NativeParser::DoFullParsing(): Add priority header file: '/usr/include/c++/4.6/cstddef'
NativeParser::DoFullParsing(): Add priority header file: '/usr/include/boost/config.hpp'
NativeParser::DoFullParsing(): Add priority header file: '/usr/include/boost/filesystem/config.hpp'
NativeParser::DoFullParsing(): Add 3 priority file(s) for project 'ProjectTest'...
NativeParser::DoFullParsing(): Added 1 header&source file(s) for project 'ProjectTest' to batch-parser...
ClassBrowser::UpdateClassBrowserView(): No active project available.
NativeParser::GetAllPathsByFilename(): Traversing XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
NativeParser::GetAllPathsByFilename(): Found 1 files:
- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
NativeParser::CreateParser(): Finish creating a new parser for project 'ProjectTest'
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
NativeParser::OnParserStart(): Starting batch parsing for project 'ProjectTest'...
NativeParser::OnParserEnd(): Project 'ProjectTest' parsing stage done!
Project 'ProjectTest' parsing stage done (106 total parsed files, 3849 tokens in 0 minute(s), 0.694 seconds).
NativeParser::GetAllPathsByFilename(): Traversing 'XXXXXXXXXXXXXXXXXXXXXX' for: main.*
NativeParser::GetAllPathsByFilename(): Traversing 'XXXXXXXXXXXXXXXXXXXXXX' for: main.*
NativeParser::GetAllPathsByFilename(): Found 1 files:
- XXXXXXXXXXXXXXXXXXXXXXXXXXXX
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
SystemHeadersThread: /usr/include/c++/4.6/ , 606
SystemHeadersThread: /usr/include/c++/4.6/i686-linux-gnu/ , 46
SystemHeadersThread: /usr/include/c++/4.6/backward/ , 8
SystemHeadersThread: /usr/lib/gcc/i686-linux-gnu/4.6/include/ , 38
SystemHeadersThread: /usr/local/include/ , 0
SystemHeadersThread: /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/ , 4
SystemHeadersThread: /usr/include/i386-linux-gnu/ , 251
SystemHeadersThread: /usr/include/ , 13980
SystemHeadersThread: Total number of paths: 8

Offline D101101

  • Single posting newcomer
  • *
  • Posts: 7
Re: linux, code completion
« Reply #7 on: October 25, 2013, 06:25:48 am »
Ubuntu 12.04 + Xfce
I tried different encodings


I tried to open a project and then close and open the other, but that's all
Code
~$ codeblocks --debug-log

(codeblocks:2577): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'

(codeblocks:2577): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed

(codeblocks:2577): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'

(codeblocks:2577): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed

(codeblocks:2577): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'

(codeblocks:2577): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed

(codeblocks:2577): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'

(codeblocks:2577): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed

Code
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/c++/4.6
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/c++/4.6/i686-linux-gnu
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/c++/4.6/backward
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/lib/gcc/i686-linux-gnu/4.6/include
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/local/include
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include/i386-linux-gnu
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /usr/include

Now I think the problem is in the global search paths.

I have added search paths in project options after that it start to work fine.

How can I add these paths in global sittings?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2954
Re: linux, code completion
« Reply #8 on: October 25, 2013, 10:00:27 am »
Settings->Compiler

greetings

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: linux, code completion
« Reply #9 on: October 25, 2013, 11:05:31 am »
Ubuntu 12.04 + Xfce
I tried different encodings


I tried to open a project and then close and open the other, but that's all
Code
~$ codeblocks --debug-log

(codeblocks:2577): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'

(codeblocks:2577): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed
(codeblocks:2577): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed

Wrong output - that is the console. The debug log is in a Tab on the main app window in a panel at the bottom of the screen - same panel as compiler output just different tab.


Quote
Now I think the problem is in the global search paths.

I have added search paths in project options after that it start to work fine.

These are standard headers so you shouldn't have to add them unless they are in an unusual place. Are you using a custom compiler install?

Offline D101101

  • Single posting newcomer
  • *
  • Posts: 7
Re: linux, code completion
« Reply #10 on: October 25, 2013, 01:43:58 pm »
Wrong output - that is the console. The debug log is in a Tab on the main app window in a panel at the bottom of the screen - same panel as compiler output just different tab.
Code: code::blocks debug
Initialize EditColourSet .....
Initialize EditColourSet: done.
Loading menubar...
ScriptedWizard: loaded
ProjectsImporter: loaded
Compiler: loaded
AStylePlugin: loaded
Abbreviations: loaded
CodeCompletion: loaded
Debugger: loaded
ToDoList: loaded
Autosave: loaded
FilesExtensionHandler: loaded
ClassWizard: loaded
OpenFilesList: loaded
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 '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 'SDL 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 'ARM Project'
Project wizard added for 'AVR 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 'C/C++ header'
File(s) wizard added for 'Fortran source'
Scripted wizard plugin activated
Foreign projects importer 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 MSP430"
Added compiler "PGI Fortran Compiler"
Added compiler "LLVM D Compiler"
Added compiler "GNU GCC Compiler for PowerPC"
Added compiler "LLVM Clang Compiler"
Added compiler "*No Compiler*"
Added compiler "Digital Mars D Compiler"
Added compiler "GNU GCC Compiler for TriCore"
Added compiler "Tiny C Compiler"
Added compiler "Small Device C Compiler"
Added compiler "GNU GCC Compiler for AVR"
Compiler plugin activated
Source code formatter (AStyle) plugin activated
Abbreviations plugin activated
Code completion plugin activated
Debugger plugin activated
Todo List plugin activated
Autosave plugin activated
Files extension handler plugin activated
Class wizard plugin activated
Open files list plugin activated
Loading toolbar...
ClassBrowser::UpdateClassBrowserView(): No active project available.
Initializing plugins...
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
Loading project file...
Parsing project file...
Loading target Debug
Loading target Release
Loading project files...
1 files loaded
Done loading project in 23ms
Project's base path: /home/sergey/.programming/project/codeblocks/test/
Project's common toplevel path: /home/sergey/.programming/project/codeblocks/test/
Mozilla universal detection engine detected 'Pure *ASCII*'.
Final encoding detected: Unicode 8 bit (UTF-8) (ID: 41)
Project data set for /home/sergey/.programming/project/codeblocks/test/main.c
Top Editor: /home/sergey/.programming/project/codeblocks/test/main.c
NativeParser::DoFullParsing(): AddCompilerPredefinedMacros failed!
NativeParser::DoFullParsing(): Adding three kind of files to batch-parser
NativeParser::DoFullParsing(): Added 1 header&source file(s) for project 'test' to batch-parser...
ClassBrowser::UpdateClassBrowserView(): No active project available.
NativeParser::GetAllPathsByFilename(): Traversing '/home/sergey/.programming/project/codeblocks/test' for: main.*
NativeParser::GetAllPathsByFilename(): Found 1 files:
- /home/sergey/.programming/project/codeblocks/test/main.c
NativeParser::CreateParser(): Finish creating a new parser for project 'test'
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
NativeParser::OnParserStart(): Starting batch parsing for project 'test'...
NativeParser::OnParserEnd(): Project 'test' parsing stage done!
Project 'test' parsing stage done (1 total parsed files, 1 tokens in 0 minute(s), 0.012 seconds).
NativeParser::GetAllPathsByFilename(): Traversing '/home/sergey/.programming/project/codeblocks/test' for: main.*
NativeParser::GetAllPathsByFilename(): Traversing ' - /home/sergey/.programming/project/codeblocks/test/' for: main.*
NativeParser::GetAllPathsByFilename(): Found 1 files:
- /home/sergey/.programming/project/codeblocks/test/main.c
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
Re-parsed 1 files.
NativeParser::OnParserStart(): Starting re-parsing for project 'test'...
Project 'test' parsing stage done (1 total parsed files, 1 tokens in 0 minute(s), 0.011 seconds).
NativeParser::GetAllPathsByFilename(): Traversing '/home/sergey/.programming/project/codeblocks/test' for: main.*
NativeParser::GetAllPathsByFilename(): Traversing ' - /home/sergey/.programming/project/codeblocks/test/' for: main.*
NativeParser::GetAllPathsByFilename(): Found 1 files:
- /home/sergey/.programming/project/codeblocks/test/main.c
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
Reparsing when typing for editor /home/sergey/.programming/project/codeblocks/test/main.c
NativeParser::OnParserStart(): Starting re-parsing for project 'test'...
Project 'test' parsing stage done (1 total parsed files, 1 tokens in 0 minute(s), 0.012 seconds).
NativeParser::GetAllPathsByFilename(): Traversing '/home/sergey/.programming/project/codeblocks/test' for: main.*
NativeParser::GetAllPathsByFilename(): Traversing ' - /home/sergey/.programming/project/codeblocks/test/' for: main.*
NativeParser::GetAllPathsByFilename(): Found 1 files:
- /home/sergey/.programming/project/codeblocks/test/main.c
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.

Quote
Are you using a custom compiler install?
No

Offline D101101

  • Single posting newcomer
  • *
  • Posts: 7
Re: linux, code completion
« Reply #11 on: October 25, 2013, 06:44:11 pm »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2954
Re: linux, code completion
« Reply #12 on: October 25, 2013, 08:33:26 pm »
everything you set here is a global compiler option... so if you set here a search path, this is a search path for every project...

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: linux, code completion
« Reply #13 on: October 25, 2013, 09:52:49 pm »
I am confused why you don't have the "Caching GCC default include dir ..." messages in your log. You can probably workaround by adding those paths to compiler settings -> search directories tab but you should not have to, it should just work.

Offline D101101

  • Single posting newcomer
  • *
  • Posts: 7
Re: linux, code completion
« Reply #14 on: October 27, 2013, 05:46:26 pm »
I have added this paths to search directories for compiler and linker, it works.
Thank you.
P.S. I didn't try to do this because I thought if the code compiles without errors, then it is set up correctly..