title: Configure eclipse with c++11
body: <p>First of all, I have already checked different solutions:</p>
  
  <p><a href="https://stackoverflow.com/questions/17274032/c-threads-stdsystem-error-operation-not-permitted">Threads std::system_error</a></p>
  
  <p><a href="https://stackoverflow.com/questions/21129735/g-4-8-1-c-threads-stdsystem-error-operation-not-permitted">Threads std::system_error II</a></p>
  
  <p><a href="https://stackoverflow.com/questions/19463602/compiling-multithread-code-with-g">Compile multithreading with gcc</a></p>
  
  <p><a href="https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1228201" rel="nofollow noreferrer">Bug gcc multithreading</a></p>
  
  <p><em>My environment:</em></p>
  
  <p>Ubuntu 1404 64bits</p>
  
  <p>gcc 4.8.2</p>
  
  <p>Eclipse IDE for C/C++ Developers</p>
  
  <p>Version: Luna Service Release 1 (4.4.1)
  Build id: 20140925-1800</p>
  
  <p>Following these links I managed to compile and run a basic thread program(the code was taken from one of the links in SO, but cannot find it again. If someone sees it, please edit my question to add the reference).</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;thread&gt;
  #include &lt;vector&gt;
  
  void func(int tid)
  {
      std::cout &lt;&lt; "Launched by thread " &lt;&lt; tid &lt;&lt; std::endl;
  }
  
  int main()
  {
      std::vector&lt;std::thread&gt; th;
  
      int nr_threads = 10;
      for(int i = 0; i &lt; nr_threads; ++i)
      {
          th.push_back(std::thread(func, i));
      }
  
      for(auto &amp;t : th)
      {
          t.join();
      }
  
      return 0;
  }
  </code></pre>
  
  <p>The command I use to compile it is the following(<strong>THIS WORKS</strong> and the output file is executable):</p>
  
  <p><code>g++ --std=c++11 -pthread test.cpp -o test.out</code></p>
  
  <pre><code>Launched by thread 1
  Launched by thread 5
  Launched by thread 3
  Launched by thread 6
  Launched by thread 4
  Launched by thread 0
  Launched by thread 7
  Launched by thread 8
  Launched by thread 9
  Launched by thread 2
  </code></pre>
  
  <p>The problem is when I try to setup my eclipse project. I can compile but it cannot produce a valid runnable output.</p>
  
  <p><em>Compile log:</em></p>
  
  <pre><code>12:09:45 **** Incremental Build of configuration Debug for project test ****
  make all 
  Building file: ../test.cpp
  Invoking: GCC C++ Compiler
  g++ --std=c++11 -pthread -D__cplusplus=201103L -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"test.d" -MT"test.d" -o "test.o" "../test.cpp"
  Finished building: ../test.cpp
  
  Building target: test
  Invoking: GCC C++ Linker
  g++  -o "test"  ./test.o   
  Finished building target: test
  
  
  12:09:46 Build Finished (took 780ms)
  </code></pre>
  
  <p>I was changing different settings for the builder, dialects... as they say in the links trying to get the same command I can use to compile from the terminal. But no way to create a valid output file from the eclipse. It always shows this error:</p>
  
  <p><code>terminate called after throwing an instance of 'std::system_error'
    what():  Enable multithreading to use std::thread: Operation not permitted</code></p>
  
  <p>Any idea how to setup eclipse?</p>
  
  <p><strong>Update:</strong>
  Following the indications of <a href="https://stackoverflow.com/questions/26673574/configure-eclipse-with-c11/26673983?noredirect=1#comment41947419_26673574">@Dirk</a> I tested in a virtual machine and it works just adding the pthread to the linker libraries.</p>
  
  <p>But for my initial setup it still fails. I made it working after modifying the C/C++ Build settings G++ linker command to <code>g++ --std=c++0x -pthread</code></p>
  
  <p>So, it seems obvious that my first environment is missing something. </p>