Friday, January 15, 2010

Auto-Completion problem in Eclipse while programming in C/C++ solved

Eclipse supports auto-completion for both typedef structs and structs without type definition declarations, in contrary to the information that might be found on the web.

To have Auto-completion for structs using "->" or "." just do the following using the Eclipse IDE:

1) Window -> Preferences -> C/C++ -> Editor -> Content Assistant

2) Mark all except "Present proposals in alphabetic order" if not necessary.

3) All the headers you create with struct declarations must be known by the IDE. Therefore all the folders containing the headers must be added to the project:

3.1) Project -> Properties -> C/C++ General -> Paths and Symbols
3.2) In the "Includes" Separator, add all the folders containing the headers (except the root folder of the project). This is, if you have the following folder structure

/root
- /Headers
- reference.h
- /FunctionDeclarations
- main.c

the folder "Headers/" must be added with the "Add" option in the Paths and Symbols.


Simple as that.