title: Eclipse compiles successfully but still gives semantic errors
body: <p><em>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</em></p>
  
  <h1>The problem:</h1>
  
  <p>I am using Eclipse Juno ADT. Everything was working fine until I tried to update the NDK. I replaced my <code>ndk</code> folder (that was the <code>ndk-r8d</code>) by the new version (i.e. <code>ndk-r8e</code>) and, in my <code>Paths and Symbols</code> configuration, I changed the includes to go from g++ 4.6 to 4.7.</p>
  
  <p>It seemed to break my index: <strong>I could compile my code, but Eclipse was giving semantic errors, exactly like in [<a href="https://stackoverflow.com/questions/15612673/eclipse-cdt-displays-semantic-error-but-builds-successfully">1</a>] and [<a href="https://stackoverflow.com/questions/10103465/eclipse-cdt-complains-about-unresolved-functions-but-still-builds-successfully">2</a>].</strong> The errors <em>mainly</em> come from symbol used by OpenCV4Android, such as <code>distance</code>, <code>pt</code>, <code>queryIdx</code> and <code>trainIdx</code>.</p>
  
  <p>When I tried to backup to my old configuration, the index was still broken! I cannot find a way to change this.</p>
  
  <hr>
  
  <h1>What I have tried</h1>
  
  <ul>
  <li>Clean up the project</li>
  <li>Rebuild, refresh, and all the other options in the "Index" submenu (when "right-clicking" on the project)</li>
  <li>Disable / enable the indexer in the preferences</li>
  <li>Verify that symbols such as <code>trainIdx</code> only appear in my OpenCV4Android include in the <code>Paths and Symbols</code> section.</li>
  <li>Change the order of my includes in the <code>Paths and Symbols</code> section. I basically tried to put the OpenCV include in the beginning and in the end.</li>
  </ul>
  
  <hr>
  
  <h1>Some observations</h1>
  
  <h2>What is not working</h2>
  
  <p>I assume that it is the <strong>CDT index</strong> because of the following:</p>
  
  <ul>
  <li>In command line, I can build my project using <code>ndk-build clean</code> and <code>ndk-build</code>.</li>
  <li>When I start Eclipse, I have no error until I open a C++ file (from the <code>jni</code> folder).</li>
  <li>I can always build the project, but as long as I have opened a C++ file, I can't run the application anymore because of a lot of <code>Field '&lt;name&gt;' could not be resolved.</code></li>
  <li>If I don't open the C++ files, Eclipse doesn't report any error and can build and deploy the Android application successfully.</li>
  </ul>
  
  <h2>Interesting fact</h2>
  
  <p>The following code reports errors on <code>line</code>, <code>queryIdx</code>, <code>pt</code>:</p>
  
  <pre><code>cv::line(mRgb, keypointsA[matches[i].queryIdx].pt, keypointsB[matches[i].trainIdx].pt, cv::Scalar(255, 0, 0, 255), 1, 8, 0);
  </code></pre>
  
  <p>If I write it as follows, it works:</p>
  
  <pre><code>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);
  </code></pre>
  
  <p>It is not that all of the OpenCV functions are unresolved: only <code>pt</code>, <code>queryIdx</code> and <code>trainIdx</code> are.</p>
  
  <p>Any comment will be really appreciated.</p>