Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Newbie questions: defining recursive include paths, defining macros with argueme
Newbie questions: defining recursive include paths, defining macros with argueme [message #160014] Wed, 07 December 2005 23:15 Go to next message
Eclipse UserFriend
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 #1794533 is a reply to message #160014] Sat, 01 September 2018 07:09 Go to previous messageGo to next message
Sigma Pic is currently offline Sigma PicFriend
Messages: 3
Registered: September 2018
Junior Member
Same question here.
How to recursively add include paths ?
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 Go to previous messageGo to next message
David VavraFriend
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.





Re: Newbie questions: defining recursive include paths, defining macros with argueme [message #1794836 is a reply to message #1794689] Fri, 07 September 2018 12:24 Go to previous messageGo to next message
trampas Mising name is currently offline trampas Mising nameFriend
Messages: 43
Registered: July 2009
Member
The recursive include paths have been a pain for sometime. As far as I know you have to add each include path to eclipse which can be a major PITA, I have projects with 100s of nested include paths.

I have started putting the paths in the #include statements in my code such that I do not have to deal with the lack for regular expressions in the CDT include paths. It also makes it easier when others pick up the code and use a different IDE.
Re: Newbie questions: defining recursive include paths, defining macros with argueme [message #1794837 is a reply to message #1794689] Fri, 07 September 2018 12:24 Go to previous message
trampas Mising name is currently offline trampas Mising nameFriend
Messages: 43
Registered: July 2009
Member
The recursive include paths have been a pain for sometime. As far as I know you have to add each include path to eclipse which can be a major PITA, I have projects with 100s of nested include paths.

I have started putting the paths in the #include statements in my code such that I do not have to deal with the lack for regular expressions in the CDT include paths. It also makes it easier when others pick up the code and use a different IDE.
Previous Topic:Photon upgrade: Errors exist in the active configuration
Next Topic:Debugging OpenJDK 8 C++ sources using Eclipse
Goto Forum:
  


Current Time: Sat Apr 20 03:38:05 GMT 2024

Powered by FUDForum. Page generated in 0.03333 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top