SIGABRT signal received when creating a std::thread c++11
c++, c++11, gcc, multithreading, stl
Solution
According to Mark Garcia suggestion and example, and according to this question I just added `-pthread` as option to the compiler.
For an unknown reason, my other projects work correctly but I believe that it is due to Boost or Open CV that must include something that was missing from this current test.
Anyway, for the moment, it works.
Thanks!
Problem
I create a thread in a class member method like this: ``` void MyClass::startThread() { T.reset( new std::thread( &MyClass::myThreadMethod, this ) ); } void MyClass::myThreadMethod() { // ... } ``` where ``` // In header file std::unique_ptr<std::thread> T; ``` When I run `MyClass::startThread()`, I receive this: Signal received: SIGABRT (Aborted) ... If I step the code, it happens in the thread constructor. I tried to removed the `unique_ptr` like this: ``` void MyClass::startThread() { std::thread* T = new std::thread( &MyClass::myThreadMethod, this ); } ``` and the same thing occurred. I use gcc 4.8.2 on NetBeans 7.4 on Linux/Kubuntu 12.04. Someone knows what happens?