• 2
Votes
name
name Punditsdkoslkdosdkoskdo

Significance of -pthread flag when compiling

In various multi threaded C and C++ projects I've seen the -pthread flag applied to both the compiling and linking stage while others don't use it at all and just pass -lpthread to the linking stage.

Is there any danger not compiling and linking with the -pthread flag - i.e. what does -pthreadactually do ? I'm primarily interested in Linux platforms.