Eclipse CDT does not index code between #if SYMBOL #endif
I am working in webkit with Eclipse CDT as IDE, there are some classes under #if ENABLE(VI开发者_Python百科DEO) but eclipse does not index it. It thinks that they are unused blocks, is there any way by which I can tell eclipse to index everything?
Not sure about the solution you suggested, but there's another:
Open your project's properties, go to C/C++ General
-> Path and Symbols
-> Symbols
, make sure you have Configuration
set to All configurations
and then add there any preprocessor symbols you'd like to have defined.
Please check
https://bugs.eclipse.org/bugs/show_bug.cgi?id=240194#c1
If you for example have problems in indexing "#if DEBUG" then the indexing result will depend on how DEBUG is defined.
This really depends on the definition of the DEBUG macro:
#define DEBUG ---> // syntax error (#if with no expression)
#define DEBUG 1 ---> // ok, selects if-branch (#if 1)
#define DEBUG 0 ---> // ok, selects else-branch (#if 0)
#undef DEBUG ---> // ok, selects else-branch (#if DEBUG)
You should probably use #ifdef DEBUG instead.
Or you can define DEBUG = 1.
Go to Project --> Settings --> C/C++ General --> Preprocessor Include --> Entries.
Under "Setting Entries" select "CDT User Setting Entries".
Then "Add..."
Then select "Preprocessor Macro" and add the name and value.
精彩评论