NOTE: it apparently is a recurrent question on StackOverflow, but - for what I have seen - either people never find a way or their solution does not work for me
I am using Eclipse Juno ADT. Everything was working fine until I tried to update the NDK. I replaced my ndk
folder (that was the ndk-r8d
) by the new version (i.e. ndk-r8e
) and, in my Paths and Symbols
configuration, I changed the includes to go from g++ 4.6 to 4.7.
It seemed to break my index: I could compile my code, but Eclipse was giving semantic errors, exactly like in [1] and [2]. The errors mainly come from symbol used by OpenCV4Android, such as distance
, pt
, queryIdx
and trainIdx
.
When I tried to backup to my old configuration, the index was still broken! I cannot find a way to change this.
trainIdx
only appear in my OpenCV4Android include in the Paths and Symbols
section.Paths and Symbols
section. I basically tried to put the OpenCV include in the beginning and in the end.I assume that it is the CDT index because of the following:
ndk-build clean
and ndk-build
.jni
folder).Field '<name>' could not be resolved.
The following code reports errors on line
, queryIdx
, pt
:
cv::line(mRgb, keypointsA[matches[i].queryIdx].pt, keypointsB[matches[i].trainIdx].pt, cv::Scalar(255, 0, 0, 255), 1, 8, 0);
If I write it as follows, it works:
cv::DMatch tmpMatch = matches[i];
cv::KeyPoint queryKp = keypointsA[tmpMatch.queryIdx];
cv::KeyPoint trainKp = keypointsB[tmpMatch.trainIdx];
cv::line(mRgb, queryKp.pt, trainKp.pt, cv::Scalar(255, 0, 0, 255), 1, 8, 0);
It is not that all of the OpenCV functions are unresolved: only pt
, queryIdx
and trainIdx
are.
Any comment will be really appreciated.
In your selected project preferences within the Eclipse environment, go to C/C++ General -> Code Analysis -> Launching. Make sure that both check boxes are unchecked. Close and reopen the project or restart eclipse and rebuild the project.