Newbie questions: defining recursive include paths, defining macros with argueme [message #160014] |
Wed, 07 December 2005 23:15 |
Eclipse User |
|
|
|
Originally posted by: wandering.womble.gmail.com
Hi there-
I've been using eclipse/cdt for a little while, and like it very much.
But there are a couple of things I haven't been able to work out how
to do, and using Google I haven't been able to find out if they're
possible or not...
1. adding external includes directories. E.g. lets say I have a
global (outside of workspace/project) include path /dev/area/include,
which is actually a large tree of directories.
I've gone into the project properties and added /dev/area/include as
an external include path.
However I seem to have to add each needed path under /dev/area/include
for it to be included in the indexer. Is there anyway to specify that
all directories under /dev/area/include should be recursively searched
by the indexer?
Note: I have auto-path discovery disabled as I'm not using eclipse to
build the components- just as a code browser (not much I can do- we're
not using gcc/anything easily compatible.)
2. the codebase I'm working with has some helper macros like:
#define special_type_of_class(x) class x
Of course this messes up the indexer. The best I've come up with is
adding a macro definition in the project properties:
'special_type_of_class=class'.
This, surprisingly, gets things indexed by the indexer. But in edit
windows, such classes are marked as having invalid syntax.
Is there some way to define the macro in the project thus:
'special_type_of_class(x)=class x', have the indexer work properly (it
doesn't if I do this currently), and also have these not marked as
errors in editor windows?
3. C++ Class browser
I've seen a few references about this around the web, and found it
incredibly useful when it was still available in CDT3.0(?). Is there
any kind of concrete timeline for when this will be fixed and back in
CDT?
I'm using eclipse build I20050923-1000 (3m2) with CDT 3.0.1.
Thanks in advance,
Regards
Julian
|
|
|
|
Re: Newbie questions: defining recursive include paths, defining macros with argueme [message #1794689 is a reply to message #1794533] |
Wed, 05 September 2018 01:50 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
A lot depends on your coding style.
Most linux distros have a base include directory /usr/include
This directory is part of the standard (builtin) include search path.
Within that are includes for a lot of library headers such as /usr/include/linux
In your code you would normally refer to headers in /usr/include/linux by, for example,
#include <linux/signal.h>
and, if /usr/include isn't in the standard search list, you would tell the compiler to add it using
-I/usr/include
You don't have to follow this convention but then you pretty much must tell the compiler every directory containing headers.
The indexer works the same way.
If you use the expected coding style, the Indexer will find your includes.
The standard directories are added by
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Providers tab --> CDT Built-in Compiler Settings
and are found in
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Entries tab --> CDT Built-in Compiler Settings
For includes from directories not in the standard search path you need to tell the Indexer to use it.
You do this by adding the directory as a User Entry wth
Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. --> Entries tab --> CDT User Setting Entries --> Add ...
You can alternately use Project --> Properties --> C/C++ General --> Paths and Symbols
Use the Help documentation to figure it out.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03574 seconds