Page 1 of 1

add include file for ...

Posted: Fri May 20, 2011 3:51 am
by jmtarrant@gmail.com
I have just discovered codelite. I switched from windows to Ubuntu a few years ago and the only thing I ever missed about windows was Codewright which I could never get to run properly under wine. Imagine my excitement when I discovered codelite offering all Codewright feature plus many more. I was particularly excited to find the menu option "add include file for" and equally disappointed when I tried it and nothing happened.
I have just done HelloWorld and was exploring the features so presumably there's something I need to configure before this will work. All the same some sort of error message would have been nice!

Any help gratefully received.
Regards
Mark

Re: add include file for ...

Posted: Fri May 20, 2011 1:38 pm
by DavidGH
Hi Mark,

It works for me :) . Try doing a full retag of your app (Workspace > Retag Workspace (full)).

Regards,

David

Re: add include file for ...

Posted: Fri May 20, 2011 11:01 pm
by eranif
DavidGH wrote: I was particularly excited to find the menu option "add include file for" and equally disappointed when I tried it and nothing happened.
This feature will work only if codelite already parsed the file containing the declaration.

i.e, you need to have this file included somewhere in your code at least once. Once codelite encounters this file, it will be able to suggest it as include file.

When codelite starts a new workspace, it has no knowledge of any symbol. It will start parsing and saving symbols, include files etc once the user will add #include <..> to its code.
So lets say you wrote this code:

Code: Select all

int main() {
fprintf(stderr, "hello\n");
return 0;
}
Now, you place the mouse over 'fprintf' and select "add include for 'fprintf'" - obviously codelite will not suggest anything, so you will need to add it by yourself.

so your code now become:

Code: Select all

#include <stdio.h>
int main() {
fprintf(stderr, "hello\n");
return 0;
}
Next, you added this line to your code:

Code: Select all

printf("another line\n");
NOW if you click on 'printf' (although you don't need it) - codelite knows about 'printf' (since it already parsed the file stdio.h and this knowledge is saved in the tags database)

HTH,
Eran


Eran