I'm using Eclipse Juno with CDT to develop my C++ project with custom makefile. I am also using C++11 features, which I got to work with Eclipse's parser following advice here on SO.
The problem is that Eclipse is unable to parse methods or fields accessed on STL container elements. E.g.:
mainapp.h
typedef struct _PlayerCalibrationData {
[...]
std::string getSamplesStr()
{
[...]
}
} PlayerCalibrationData;
std::vector<MainApp::PlayerCalibrationData> m_calibrationData;
mainapp.cpp
m_calibrationData[0].getSamplesStr();
getSamplesStr() will be underlined and marked as an error, with the message "Method 'getSamplesStr' could not be resolved".
The compiler doesn't complain, though, regardless of whether I invoke it from Eclipse or from the command line.
Also, when I type m_calibrationData., all vector methods pop up via content assist (i.e. it's not an issue of Eclipse not finding the vector include), but as soon as I access an element via [] or at(), content assist is quiet and anything typed manually is marked as an error.
Is it normal that this doesn't work? If yes, is there a way I can turn off assist/correction for template-based containers specifically?
EDIT
I now also tried disabling c++11 support, and if I do that the problem disappears -- but then of course the c++ 11 types and syntax aren't recognized.
EDIT 2
I imported a second project, entered exactly the same settings, and for this project the parsing works. The only difference is the project layout (different location of makefiles). But even if I delete and re-import the first project, it still doesn't work.
operator[]forstd::vector. Do you also get errors like "Invalid arguments" for statements likefoo.push_back(m_calibrationData[0])? See this bug - Adam Paetznick