title: THREAD ERROR: invalid use of non-static member function
body: <p>I'm trying to understand threads in C++ but I don't know how to solve this problem.</p>
  
  <p>I want to call two threads to run the function called "createS" but I get this error:</p>
  
  <blockquote>
    <p>error: invalid use of non-static member function</p>
  </blockquote>
  
  <p>I've read other questions about this topic but I really don't understand how to make my code works.</p>
  
  <p>Could someone explain me what I'm doing wrong and try to help my find a solution?</p>
  
  <p><strong>test_class.cpp</strong></p>
  
  <pre><code>void test_class::generateS(){
  
       map1=new multimap&lt;double,vector&lt;int&gt;&gt;;
       map2=new multimap&lt;double,vector&lt;int&gt;&gt;;
  
       thread thread_1( createS, 0, nCells/2, map1 ); 
       thread thread_2( createS, nCells/2, nCells, map2);
  
       thread_1.join();
       thread_2.join();
  }
  
  void test_class::createS(int startP, int endP, Costs *mapPointer){
       //i do some stuff
  }
  </code></pre>
  
  <p><strong>test_class.h</strong></p>
  
  <pre><code>void createS(int start, int end, Costs *mapPointer);
  void generateS();
  </code></pre>