title: Eclipse c++11 // vector
body: <p>This is really driving me crazy:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;string.h&gt;
  #include &lt;thread&gt;
  
  using namespace std;
  
  void test() {
      vector&lt;string&gt; myvector;
      string a("Teststring");
      myvector.push_back(a);
      cout &lt;&lt; myvector.begin()-&gt;length() &lt;&lt; endl;
  }
  
  int main() {
      thread(test).join();
      return 0;
  }
  </code></pre>
  
  <p>The code compiles fine with the  -std=c++11 flag to the compiler and the -pthread flag to the linker. </p>
  
  <p>BUT: Eclipse does either know the std::thread or the myvector.begin()->length(), even if the code runs fine eclipse warns me <strong>"Method 'length' could not be resolved"</strong>.</p>
  
  <p>I tried every possible solution in here: <a href="https://stackoverflow.com/questions/9131763/eclipse-cdt-c11-c0x-support">Eclipse CDT C++11/C++0x support</a> without any success. This took me so many hours now, what am I doing wrong?!</p>
  
  <p>Is there anybody getting a project setup without problems with this code?</p>
  
  <p><strong>EDIT: Other code example - same problem:</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;thread&gt;
  
  
  using namespace std;
  
  class TestClass {
  public:
      void test() {
          cout &lt;&lt; "test" &lt;&lt; endl;
      }
  };
  
  void test() {
      vector&lt;TestClass&gt; testClassVector;
      TestClass x;
      testClassVector.push_back(x);
      testClassVector.begin()-&gt;test();
  }
  
  int main() {
      thread(test).join();
  
      return 0;
  }
  </code></pre>
  
  <p>Compiles and runs correct, but returns in eclipse: <strong>Method 'test' could not be resolved</strong></p>
  
  <p><strong>EDIT:</strong></p>
  
  <p><em>working versions:</em></p>
  
  <pre><code>((TestClass)*(testClassVector.begin())).test();
  
  TestClass foo2 = *(testClassVector.begin());
      foo2.test();
  </code></pre>
  
  <p><em>still not working:</em></p>
  
  <pre><code>testClassVector.begin()-&gt;test();
  </code></pre>
  
  <p>The last compiles and works like the two above, but eclipse still claims:</p>
  
  <p><em>Method 'test' could not be resolved</em></p>