Jak zrobić CDT / Eclipse z wątkami C ++ 11?

Próbowałem przetestować przykład wątków C ++ 11 w Eclipse. Ale otrzymałem ten komunikat podczas uruchamiania programu:

zakończ wywoływane po wywołaniu instancji 'std :: system_error' what (): Operacja niedozwolona '

Mój system: ubuntu + gcc 4.7

Program:

<code>#include <iostream>
#include <thread>

void worker()
{
    std::cout << "hello from worker" << std::endl;
}

int main(int argc, char **argv)
{
    std::thread t(worker);
    t.join();
}
</code>

... i tak, umieściłem-std=c++11 i-pthread wewnątrzC/C++ Build -> Settings -> Tool Settings -> Cross G++ Compiler -> Miscellaneous -> Other Flags.

Jakieś komentarze?

questionAnswers(3)

yourAnswerToTheQuestion