I tried to test an example of C++11 threads in Eclipse. But I got this message when running the program:
terminate called after throwing an instance of 'std::system_error' what(): Operation not permitted'
...and yes, I put -std=c++11 and -pthread inside C/C++ Build -> Settings -> Tool Settings -> Cross G++ Compiler -> Miscellaneous -> Other Flags.
About the link: The only thing that thread suggests is to use -lpthread instead of -pthread. I examined it but I still get the same error. A strange thing with that thread is that his problem was solved by changing the order of parameters.
Another thing is that I have no problem when compiling this program in command line like this:
I asked the same question at stackoverflow, and here is the answer: (the forum doesn't let me to post links)
That error definitely happens when -pthread isn't used (even if you only have one libstdc++ installed). Make sure -pthread is used for the compiler command and the linker command. Otherwise libpthread.so won't be linked to and threads cannot be launched at runtime.
Then I added -pthread to C/C++ Build -> Settings -> Tool Settings -> Cross G++ **Linker** -> Miscellaneous -> Other Flags and the program worked correctly.