C ++ 11 Błąd inicjowania wątku przy kompilacji funkcji składowych [duplikat]

To pytanie ma już odpowiedź tutaj:

Rozpocznij wątek z funkcją członka 5 odpowiedzi

Zaczynam używać wątków C ++ 11 i mam problem z (prawdopodobnie głupim) błędem. To jest mój przykładowy program:

#include <iostream>
#include <thread>
#include <future>
using namespace std;

class A {
public:
  A() {
    cout << "A constructor\n";
  }

  void foo() {
    cout << "I'm foo() and I greet you.\n";
  }

  static void foo2() {
    cout << "I'm foo2() and I am static!\n";
  }

  void operator()() {
    cout << "I'm the operator(). Hi there!\n";
  }
};

void hello1() {
  cout << "Hello from outside class A\n";
}

int main() {
  A obj;
  thread t1(hello1); //  it works
  thread t2(A::foo2); // it works
  thread t3(obj.foo); // error
  thread t4(obj);     // it works

  t1.join();
  t2.join();
  t3.join();
  t4.join();
  return 0;
}

Czy można rozpocząć wątek od funkcji czystego elementu? Jeśli nie jest, jak mogę owinąć mójblunkcja @ z obiektu obj, aby móc utworzyć taki wątek? Z góry dziękuję

To jest błąd kompilacji:

thread_test.cpp: W funkcji „int main ()”: thread_test.cpp: 32: 22: błąd: brak pasującej funkcji dla wywołania „std :: thread :: thread ()”

thread_test.cpp: 32: 22: uwaga: kandydatami są:

/ usr / include / c ++ / 4.6 / thread: 133: 7: note: std :: thread :: thread (_Clalable &&, _Args && ...) [with _Callable = void (A :: *) (), _Args = { }]

/ usr / include / c ++ / 4.6 / thread: 133: 7: note: brak znanej konwersji dla argumentu 1 z „’ ”na„ void (A :: * &&) () ’

/ usr / include / c ++ / 4.6 / thread: 128: 5: note: std :: thread :: thread (std :: thread &&)

/ usr / include / c ++ / 4.6 / thread: 128: 5: note: brak znanej konwersji dla argumentu 1 z „’ ”na„ std :: thread && ’

/ usr / include / c ++ / 4.6 / thread: 124: 5: note: std :: thread :: thread ()

/ usr / include / c ++ / 4.6 / thread: 124: 5: note: kandydat oczekuje 0 argumentów, 1 pod warunkiem

questionAnswers(1)

yourAnswerToTheQuestion