title: C++11, GCC 4.8.1,Code::Blocks, threading, what a head ache
body: <p><strong>--EDIT</strong>
  If you would like to use MinGW GCC 8.4.1 and threads/mutex/futures/atomics do not download the Win32 threader version insted download the Posix version.
  <strong>--EDIT</strong></p>
  
  <p>My installation of MinGW is as follows:
  x32-4.8.1-release-win32 (as the threader) - sjlj rev 5</p>
  
  <p>I have unpacked and correctly confirmed that <strong>MinGW GCC 4.8.1 (revision 5) is installed in C:\MinGW\mingw32.</strong>   I have set up Code Blocks to look for the latest and greatest compiler in the correct path (this I am sure of).  I can compile a normal program using <strong>#include iostream.</strong>  Ok now when I try and run a program using <strong>#include thread</strong> it gives me <strong>"error: 'thread' is not a member of 'std'".</strong>  </p>
  
  <p><em>Now here is what I have done and what I have tried:</em> </p>
  
  <p>I am <strong>following a sort of template or tutorial here at</strong> <a href="http://www.cplusplus.com/reference/thread/thread/?kw=thread" rel="nofollow">cplusplus.com</a>.<br>
  I have the code exactly as it is presented on the webpage (towards the bottom).<br>
  I have tried, in Code Blocks, to use Compiler flags <strong>"Have g++ follow the C++11 ISO language standard -std=c++11".</strong>  </p>
  
  <p>I have also tried the flag <strong>"Have g++ follow the coming C++0x ISO language standard -std=c++0x"</strong> </p>
  
  <p>I have tried both at the same time and one at a time, no mas.
  I have also tried those commands <strong>manually</strong>.  </p>
  
  <p>Another command I tried manually was <strong>-std=gnu++11</strong> which was recommended in the thread header.  </p>
  
  <hr>
  
  <p><strong>--EDIT</strong>
  It seems like <strong>__cplusplus</strong> is &lt; 201103L which is stated (or rather defined) in the thread header. 
  This only happens when I manually use -std=c++11, for some reason C::B removes it if it was manually stated so I must use a check box to use this flag...
  <strong>--EDIT</strong></p>
  
  <p>My compiler settings under the <strong>Toolchain Executables tab</strong> are as follows:</p>
  
  <p>C compiler: <strong>i686-w64-mingw32-gcc-4.8.1.exe</strong></p>
  
  <p>C++ compiler: <strong>i686-w64-mingw32-c++.exe</strong></p>
  
  <p>Linker for dynamic: <strong>i686-w64-mingw32-c++.exe</strong></p>
  
  <p>Linker for static: <strong>ar.exe</strong></p>
  
  <p>Debbuger: <strong>GDB/CDB debugger: default</strong></p>
  
  <p>Resource compiler: <strong>windres.exe</strong></p>
  
  <p>Make Program: <strong>mingw32-make.exe</strong></p>
  
  <p>I have tried using other executables in the bin folder and still no luck...
  I'm starting to wonder if GCC supports C++11 or threading !?</p>
  
  <p>Has anyone been able to get threads to work with MinGW GCC, Code blocks or in general?
  If so how did you do it? Any links that might help? Any advice?</p>
  
  <p>P.S. I know there are other ways of threading like posix or other SDK's like SFML (I have successfully tried threading with this).  But I want to use GCC threading and I'm quite baffled as to why it is so hard to do seeing as all the necessary files are there...</p>
  
  <p><strong>--EDIT</strong>
  I have found that when I manually compile the program outside of Code Blocks I still get the same errors, whether I use g++ c++ or i686-w64-mingw32-g++/c++</p>
  
  <p>here is the command I run to build the files:</p>
  
  <blockquote>
    <p>C:\MinGW\mingw32\bin>g++.exe -D__GXX_EXPERIMENTAL_CXX0X__ -o0 -g3
    -Wall -c -fmes sage-length=0 -std=c++11 -Wc++11-compat -o obj\Debug\main.o "F:\C Projects\Code Blocks\thread\main.cpp"</p>
  </blockquote>
  
  <p>still returns error: 'thread' is not a member of 'std'</p>
  
  <p>Could this be a bad build? I will try other revisions...
  <strong>--EDIT</strong></p>