Code completion not showing all options - Using SDL

CodeLite installation/troubleshooting forum
hydren
CodeLite Curious
Posts: 7
Joined: Mon Aug 13, 2012 5:57 pm
Genuine User: Yes
IDE Question: C++
Contact:

Code completion not showing all options - Using SDL

Post by hydren »

Hello everybody, I'm trying to use code lite to make a SDL program with C++. Everything was perfect until I realized that not all options shows up in codelite autocompletion. Simple and common stuff like SDL_Surface and SDL_Rect structs, functions like SDL_SetVideoMode() and SDL_PollEvent() doesnt show up when I type "SDL_". The only options that shows up are the same: some SDL macros, and the main functions like SDL_Init() and SDL_Quit(). I think that's not supposed to happen, since when I build the program, everything compiles fine, and I can run the executable just fine. I guess it means that all SDL related files are in the right places inside MinGW folder. Also, I tried to do the same with Eclipse CDT, and its autocompletion shows everything just fine. It looks like there is kinda of a limit on the number of suggestions codelite autocompletion shows. It is really odd :| . Also, is there a way to make the cppcheck plugin parse the currently editing file as you type (something like eclipse does), or to make it more "accessible", like a keyboard shortcut or a quick interface button? Having to change to explorer tab and right clicking the file to cppcheck is tiring...
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code completion not showing all options - Using SDL

Post by eranif »

Please specify your OS / codelite version
hydren wrote:It looks like there is kinda of a limit on the number of suggestions codelite autocompletion shows. It is really odd
You might want to change that from: "Settings -> Tags Settings -> Display and behavior -> Number of items to display in the completion box" atm it is set to 50 (but the list is dynamic and it will display new options as you type)

But again, I need to know which OS are you using.

Eran
Make sure you have read the HOW TO POST thread
hydren
CodeLite Curious
Posts: 7
Joined: Mon Aug 13, 2012 5:57 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code completion not showing all options - Using SDL

Post by hydren »

Oops sorry.
I'm testing on a Windows 7 Professional 64-bit, with codelite 4.0.5589, MinGW 4.6.1 (that one that comes with codelite), SDL 1.2.14
I've just tried to change the number of itens to display to 1000, but with no luck. :| . I counted the number of items showing and they're only 24 items. Of course, as I type and match one of those 24, it shows less options accordingly.
Strangely, that change in "Settings -> Tags Settings -> Display and behavior -> Number of items to display in the completion box" affected the behavior when autocompleting "std::", showing a LOT of itens, when before (with 50 set) it used to show 34 itens. But, again, no changes when typing "SDL_".

Thanks for the quick reply! :D
hydren
CodeLite Curious
Posts: 7
Joined: Mon Aug 13, 2012 5:57 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code completion not showing all options - Using SDL

Post by hydren »

Wow, I think I've just solved it! :D
It seems that Codelite doesnt check "Include Files" paths subfolders contained within the ones listed. All SDL include files were in inside a folder named "SDL" in the mingw "include" folder.
This one was in the "Include Files" paths list:
c:\program files (x86)\CodeLite\mingw-4.6.1\include

But, "C:\Program Files (x86)\CodeLite\mingw-4.6.1\include\SDL", despite being inside the previous cited path, wasnt checked for items. I needed to include this in the "Include Files" paths list.
Now its working! :D All SDL itens are showing. Now I need to do the same for other libraries like OpenGL (inside GL folder).

It would be nice if Codelite could check files inside subfolders inside the folders listed in "Include Files" paths list. ;)
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code completion not showing all options - Using SDL

Post by eranif »

hydren wrote:It would be nice if Codelite could check files inside subfolders inside the folders listed in "Include Files" paths list.
codelite checks for files based on the user's input + parsing #include statements in the code

So.. if you set your search path like this (from: settings -> tags settings -> ctags)

Code: Select all

/home/eran/include/

and all your SDL files are located under

Code: Select all

/home/eran/include/SDL
AND in your code you include like this:

Code: Select all

#include <SDL_file.h>
codelite will try to find the file like this:

Code: Select all

./SDL_file.h
/home/eran/include/SDL_file.h
no need to mention that it will fail to locate it, however if you include your files like this:

Code: Select all

#include <SDL/SDL_file.h>
then codelite will be able to find it

Eran
Make sure you have read the HOW TO POST thread
hydren
CodeLite Curious
Posts: 7
Joined: Mon Aug 13, 2012 5:57 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Code completion not showing all options - Using SDL

Post by hydren »

But Eran, in my code I was declaring:

#include <iostream>
#include <SDL/SDL.h>
#include <SDL/sdl_image.h>

without this, even g++ fails to build.

I'm not sure if that could be the issue, but I was declaring all this stuff in a header "main.hpp" and using it in "main.cpp". But i did make sure that in main.cpp I included "main.hpp":

======main.hpp:

#ifndef MAIN_HPP
#define MAIN_HPP

#include <iostream>
#include <SDL/SDL.h>

#endif // MAIN_HPP

======main.cpp:

#include "main.hpp"

int main(int argc, char **argv)
{
std::cout << "hello world\n" << std::endl;
SDL_Init(SDL_INIT_VIDEO);
SDL_Surface* screen;
SDL_Event game_event;
bool leave=false;

screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE | SDL_DOUBLEBUF);

while(!leave)
{
//SDL related stuff here
}
SDL_Quit();
return 0;
}
Post Reply