Reputation: 1016
I am trying to use Eclipse CDT (just for the 'organize includes' functionality) on OS X for a C++ project. The static analyzer (syntax highlighting) doesn't seem to be able to resolve the type of a template operator overload in container classes, such as std::vector and operator[]. Example:
#include <vector>
int main() {
std::vector<std::vector<int> > st = {{0}};
st[0].size(); // Method 'size' could not be resolved
st.front().size(); // no problem
}
This code compiles in g++ and clang++. I am not excited about turning off syntax highlighting completely (what's the point of the IDE?). Any ideas on getting Eclipse CDT (specifically Neon.3 Release (4.6.3) on OS X) to understand this?
EDIT: Updated with a simpler MWE, the problem was not related to using a struct.
EDIT: Added Eclipse CDT version.
Upvotes: 2
Views: 253
Reputation: 2355
Eclipse is not compiling your code every time you type something new but it uses a tool for static StaticAnalysis. Unfortunately that tool is not perfect and things like this happen. https://wiki.eclipse.org/CDT/designs/StaticAnalysis
Upvotes: 1