#ifdef...#endif
is not indexed by the C/C++ indexer. Any code using it shows up with syntax errors. The way to fix this:
- open Project...Properties
- Go to C/C++ General...Paths and Symbols
- Open the Symbols tab
- Add each symbol that needs to be defined (with a value of 1)
This is the same as adding the
#define
in the source code. It is also equivalent to using -D switches to CFLAGS in a Makefile. For example, if the makefile has...
... CFLAGS = -c $(INC) -DFEATURE_A ...
...then
FEATURE_A
should be defined in Eclipse as a symbol with value 1. I am using Eclipse Indigo 3.7 with CDT.