Adding -pthread to eclipse, for using posix threads
15/02/2009Problem
Cannot compile c/c++ project with -pthread. Eclipse is complaining about things.
Solution
Eclipse is not configured to put the -pthread argument in the gcc compilation. To solve this, go to the Menu:
Project -> Properties
From the bar on the left:
c/c++ build -> GCC C Compiler -> Miscellaneous
Add the “-pthread” argument into the beginning of the “Other Flags” Also go to:
c/c++ build -> Settings -> GCC C Linker -> Libraries
And include the “pthread”library into the other libraries. Click Apply and rebuild the project. Pthreads must work now.
There are 31 comments in this article: