add include file for ...

General questions regarding the usage of CodeLite
jmtarrant@gmail.com
CodeLite Curious
Posts: 1
Joined: Fri May 20, 2011 3:40 am
Genuine User: Yes
IDE Question: C++
Contact:

add include file for ...

Post 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
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: add include file for ...

Post by DavidGH »

Hi Mark,

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

Regards,

David
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: add include file for ...

Post 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
Make sure you have read the HOW TO POST thread
Post Reply