My programs look below
#include <iostream> #include <thread> #include <exception> void hello() { std::cout << "Hello world!!!!" << std::endl; } int main() { std::cout << "In Main\n"; std::thread t(hello); t.join(); return 0; }
When I compile it with the following command, I get no errors
g ++ - 4.7 -std = c ++ 11 main.cpp
But when I run it, I get the following error
In main
terminate called after throwing an instance of 'std :: system_error'
what (): Operation not permitted
Aborted (core dumped)
Can someone help me with where I'm wrong?
Alwin doss
source share