Where CDT really gets confused is around the ‘exclusion’ of the unit tests for the non-test build configurations: as mentioned in my other post, one needs to add the G-Test’s include/ directory to include search path (-I).
However, I recently found out that the indexer gets confused too, if one uses the default preferences in Window > Preferences > C/C++ > Indexer (see screenshot on the left): the critical item is the “Index unused headers” which leads to a bunch of syntax errors on the unit tests, due to the fact that the entire testing:: namespace is not indexed, when the Active Build Configuration is not the Test one.
Whilst this may (possibly) be a “feature,” it annoys the hell out of me, nor did I find it particularly useful (as it’s very difficult to tell the genuine errors from the artifacts).
I have found that by enabling the indexing of unused headers, causes the syntax errors to disappear from the *_test.cc files and makes for an altogheter more pleasant working environment (see below for my settings).
One other thing worth noting is that the “Build configuration for the indexer” preference is best left alone: choosing the one that would intuitively make the most sense (Use active build configuration) causes again a whole bunch of (spurious) syntax errors to appear in your test sources.
I’ve personally not experimented enough with the “Index source and header opened in the editor,” but if anyone can figure out what the best choice would be, I’d love to hear your comments.
Finally, it’s worth noting that, if you have recently updated your install (or even, moved from Helios to Indigo) it is possibly that the configuration, indexer, etc. of your projects got seriously hosed: what got me into the quest for the “perfect indexer settings” was a bunch of mysterious syntax errors in my unit tests, which I was totally unable to resolve (although the code itself build just fine with g++).
If you do come across a similar situation (a project that used to build, and where you get unreasonable and unexplained syntax errors in Eclipse’s editor) try and change the Preferences for the C++ Indexer (even just opening the page, changing a few random settings, hitting ‘Apply‘ and then ‘Restore Defaults‘ and ‘Ok‘ should work).
 Worth noting that the (default) setting is a bit ‘circular’ as it delegates to the “build configuration specified in the project’s indexer settings;” however, the latter (unless otherwise specified) seems to defer to the Workspace settings: which must be different from just using the ‘active build configuration’ as choosing the latter causes a whole bunch of errors to appear in the test sources: hence, there must be a default, non-obvious setting which makes it all work, but no indication as to what that is.