Following code is ok on Microsoft and Clang compilers but fails on GCC. It throws std::system_error
with message -1
. Is it know issue?
#include <future>
int main()
{
std::packaged_task<void()> task([](){});
task();
}
Following code is ok on Microsoft and Clang compilers but fails on GCC. It throws std::system_error
with message -1
. Is it know issue?
#include <future>
int main()
{
std::packaged_task<void()> task([](){});
task();
}
Copyright © 2021 Jogjafile Inc.
You need to link with
-lpthread
, otherwise there is no thread support the C++ run-time library could use. This has been reported as a GCC bug:I agree that the usability here is quite poor. There is also a previous discussion.