Reputation: 23616
Our code base conditionally compiles code based on compile-time configs. CDT plugin in Eclipse currently does not index compiled-out code, so I can't jump to a function definition if it's within #ifdef
. How could I enable indexing to work?
Upvotes: 1
Views: 612
Reputation: 393114
You can't assume that code would compile if the conditionals are ignored. In this light this feature cannot work (in the general case).
I suggest using a build configuration that defines all the required symbols to compile all the blocks. Of course that means that instead of having
#ifdef FEATURE_X
code;
#else
other code;
#endif
you'll have to use the more cumbersome
#ifdef FEATURE_X
code;
#endif
#ifdef FEATURE_Y
other code;
#endif
So you can let the indexer work with -DFEATURE_X -DFEATURE_Y
. However, you can't debug in such configuration, because both blocks would get executed as well
Upvotes: 2