When compiling multithread programs in eclipse cdt, the pthread library should be configured, it is easy way.
For C project.
1. Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> GCC C Compiler -> Miscellaneous
add -pthread at the beginning of Other flags.
2. Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> GCC C Compiler -> Libaries
find the add tag, click add Enter Value pthread
Then click Apply button, click OK button.
That will add pthread library to the CDT environment.
For C++ project, it is the similar way as upper steps.