title: cannot convert '*void(MyClass::*)(void*) to void*(*)(void*) in pthread_create function
body: <p>i'm trying to create a new thread with a class "CameraManager" but i have the following error:</p>
  
  <blockquote>
    <p>cannot convert '*void(CameraManager:: * )(void*) to void*( * )(void*) in pthread_create function</p>
  </blockquote>
  
  <p>i defined in the cameramanager.h file:</p>
  
  <pre><code>public:
  void *dequeueLoop(void *ptr);
  </code></pre>
  
  <p>and in the cameramanager.cpp</p>
  
  <pre><code>void CameraManager::startDequeuing(){
  dequeuing = true;
  dequeueThreadId = pthread_create(&amp;dequeueThread, NULL, &amp;CameraManager::dequeueLoop, NULL);
  }
  
  void *CameraManager::dequeueLoop(void *ptr){
  while(dequeuing){
      highSpeedCamera-&gt;dequeue();
      highSpeedCamera-&gt;enqueue();
  }
  </code></pre>
  
  <p>I don't want to declare dequeueLoop as a static function i also tried to declare dequeueLoop as a class friend function in the following way but then it doesn't have scope on class variables 'highSpeedCamera' and 'dequeuing' and the compiler also tell me that 'dequeueLoop' was not declared in this scope</p>
  
  <p>to make dequeueLoop a friend function i did:</p>
  
  <p>cameramanager.h </p>
  
  <pre><code>public:
  friend void *dequeueLoop(void *ptr);
  </code></pre>
  
  <p>cameramanager.cpp</p>
  
  <pre><code>void CameraManager::startDequeuing(){
      dequeuing = true;
      dequeueThreadId = pthread_create(&amp;dequeueThread, NULL, &amp;CameraManager::dequeueLoop, NULL);
  }
  void *dequeueLoop(void *ptr){
      while(dequeuing){
          highSpeedCamera-&gt;dequeue();
          highSpeedCamera-&gt;enqueue();
      }
  }
  </code></pre>
  
  <p>Where i'm doing wrong?</p>