Tubbles
Tubbles

Reputation: 59

View all macros defined in source code at a given position in Eclipse CDT

Is there a possibility to view the live macros defined at the current position in the code, in Eclipse CDT?

I think that there could be a way to do this, since eclipse is smart enough to follow my header files included within the window Window > Show view > Include Browser. It can also, as of today, figure out what macros are defined and gray out areas of i.e. #ifdef which are currently not going to be compiled.

The only thing that I feel it could be missing is if I use defines in en external makefile, however they can be simulated and added to the live index via the project settings.

This is, e.g. not what I am looking for, since it would list all macros in the file/project/workspace. I want to know depending on, lets say, where I currently have my cursor in the file.

Upvotes: 0

Views: 466

Answers (1)

user184968
user184968

Reputation:

Type in the editor window:

#ifdef 

And then press Ctrl-Space. You will see the long list of all active macros

Update

1) This method correctly not shows macro before it is defined and shows after

2) However it seems Eclipse CDT has an error in handling #undef and this method incorrectly shows macro after it is undefined. I have filed a bug report http://bugs.eclipse.org/bugs/show_bug.cgi?id=472198.

Upvotes: 1

Related Questions