Because This Question was marked as Duplicate, even if doesn’t have to do with it, because there is about Linker Flag and here is about Compiler Flags, I will post My answer HERE.
You will have to go to Settings -> Compiler… and next you’ll have to click on Linker Settings TAB.
On the right side you will see Other Linker Options.
There you have to type -lpthread
and press OK.
You may need to click on rebuild after that.