Author Topic: How does code completion work?  (Read 4789 times)

Offline Fatwhale

  • Single posting newcomer
  • *
  • Posts: 2
How does code completion work?
« on: August 20, 2012, 05:24:22 pm »
Hey guys. This has probably been asked many times before, but I can't find any solution to my problem.
I come from Windows and used Visual Studio there for some time now. Now that I switch to Codeblocks I have some troubles. The biggest one at the moment is the missing code completion. I know this is NOT a missing feature in code blocks, but it's just not working for me and maybe this has got to do with my general approach using linux.

So what I do:
I use the openframeworks framework to try some "creative coding". The frameworks helps with a lot of stuff to get the users started, like a project generator. And if I use that standard framework modules code completion works great. But what I now tried to do is include the point cloud library. I installed all packages and found the include directories and the libs.
In openframeworks you have a config.make file. In there you can set some compiler flags like include dirs and linker options.

So I added the inlcudes and linked the libs. Also I added the include folder to my project using Porject-> Add files recursively. When I now include a headerfile in the header of my main class, I get code completion there. For example I include pcl/surface/organized_fast_mesh.h and when I try to declare a variable and type Organ[...] it suggests OrganizedFastMesh. Perfect. Everything I want. But this does not work in my .hpp file. Let's say I declared a variable as follows:
OrganizedFastMesh<PointXYZ>* m;

If I now try to instantiate the object in my constructor, I don't get any help. So typing
m = new Organ[...]
leaves my hanging.
Or if I type
m->
Nothing happens. This works for classes in the openFrameworks framework but not for the PCL lib I try to include. Everything compiles and works great, but I really want this to work and understand the mechanics behind it.

So could anybody please help me with this probably very simple task? I'm quite new to this and this is really frustrating. I already tried to set the search directories in C/C++ Parser options in the project properties and globally in Compiler and debugger settings->Search directories->Compiler Tab. (I added /usr/include/pcl-1.6, /usr/include/pcl-1.6/pcl and /usr/include/pcl-1.6/pcl/surface, which includes the organized_fast_mesh.h header file)
Also in Settings->Editor->Code-completion and symbols browser->C/C++ parser under Options everything is checked. (that means Follow local includes, Follow global include, Parse preprocessor directives). Code-completion is NOT disabled in the Code completion tab.

What am I missing here?

Offline Fatwhale

  • Single posting newcomer
  • *
  • Posts: 2
Re: How does code completion work?
« Reply #1 on: August 22, 2012, 03:39:37 pm »
Ok I got it. It's pretty simple. I had to add the namespace to my variable declaration in my header file.
So if I declare pcl::OrganizedFastMesh<PointXYZRGB>* m; I get everything I want...