title: C++ threading classes not working and giving functional and thread file errors
body: <p>I am very frustrated that this is not working. I read most of the stackoverflow comments and examples and none of it shown to work. I just started doing c++.</p>
  
  <p>I want the code to print "Hello World".</p>
  
  <p>Here's a sample of my code (I can give my full code but I will be unnecessary since there is a lot of code in it):</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;thread&gt;
  
  using namespace std;
  
  class Greeting {
      public:
          void hi() {
             cout &lt;&lt; "Hello World!\n";
          }
  };
  
  int main() {
  
  Greeting g;
  
  thread t(g.hi);
  t.join();
  
  return 0;
  }
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
  <pre><code>||=== Build: Debug in Cookie Island (compiler: GNU GCC Compiler) ===|
  C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\functional
  ||In instantiation of 'struct std::_Bind_check_arity&lt;void (Greeting::*)()&gt;':|
  C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\functional
  |1538|required from 'struct std::_Bind_simple_helper&lt;void (Greeting::*)()&gt;'|
  C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\functional
  |1552|  required by substitution of 'template&lt;class _Callable, class ... _Args&gt; 
  typename std::_Bind_simple_helper&lt;_Func, _BoundArgs&gt;::__type 
  std::__bind_simple(_Callable&amp;&amp;, _Args&amp;&amp; ...) 
  [with _Callable = void (Greeting::*)(); _Args = {}]'|
  C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\thread
  |142|required from 'std::thread::thread(_Callable&amp;&amp;, _Args&amp;&amp; ...) 
  [with _Callable = void (Greeting::*)(); _Args = {}]'|
  C:\Users\Andrew Shen\Desktop\Cookie Island\main.cpp|51|required from here|
  C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\functional
  |1426|error: static assertion failed: Wrong number of arguments for pointer-to-member|
  C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\functional
  ||In instantiation of 'struct std::_Bind_simple&lt;std::_Mem_fn&lt;void (Greeting::*)()&gt;()&gt;':|
  C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\thread
  |142|required from 'std::thread::thread(_Callable&amp;&amp;, _Args&amp;&amp; ...) 
  [with _Callable = void (Greeting::*)(); _Args = {}]'|
  C:\Users\Andrew Shen\Desktop\Cookie Island\main.cpp|51|required from here|
  C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\functional
  |1505|error: no type named 'type' in 'class std::result_of&lt;std::_Mem_fn&lt;void (Greeting::*)()&gt;()&gt;'|
  C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\functional
  |1526|error: no type named 'type' in 'class std::result_of&lt;std::_Mem_fn&lt;void (Greeting::*)()&gt;()&gt;'|
  ||=== Build failed: 4 error(s), 7 warning(s) (0 minute(s), 1 second(s)) ===|
  </code></pre>
  </blockquote>
  
  <p>Update:
  This is more like my code.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;thread&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  class Greeting {
      public:
          void hi(string txt) {
             cout &lt;&lt; "Hello World!"+txt &lt;&lt; endl;
          }
  };
  
  int main() {
  string t = " More...";
  
  Greeting g;
  
  thread t(g.hi, &amp;g, t);
  t.join();
  
  return 0;
  }
  </code></pre>
  
  <blockquote>
    <p>Blockquote
    ||=== Build: Debug in Cookie Island (compiler: GNU GCC Compiler) ===|
    C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\functional||In instantiation of 'struct std::_Bind_simple)>(Greeting*, std::__cxx11::basic_string*)>':|
    C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\thread|142|required from 'std::thread::thread(_Callable&amp;&amp;, _Args&amp;&amp; ...) [with _Callable = void (Greeting::<em>)(std::__cxx11::basic_string); _Args = {Greeting</em>, std::__cxx11::basic_string, std::allocator >*}]'|
    C:\Users\Andrew Shen\Desktop\Cookie Island\main.cpp|52|required from here|
    C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\functional|1505|error: no type named 'type' in 'class std::result_of)>(Greeting*, std::__cxx11::basic_string*)>'|
    C:\Program Files (x86)\CodeBlocks\MinGW\lib\gcc\mingw32\5.1.0\include\c++\functional|1526|error: no type named 'type' in 'class std::result_of)>(Greeting*, std::__cxx11::basic_string*)>'|
    ||=== Build failed: 2 error(s), 3 warning(s) (0 minute(s), 1 second(s)) ===|</p>
  </blockquote>