On Fri, Jan 6, 2012 at 1:27 PM, Alessandro Antonello wrote:

What I did mean is using `-mthreads' should add `-lpthread' automatically.
`-mthreads' is mandatory because instructs GCC to tune Windows SDK headers to
use the multi threaded version of the run time library (msvcrt{*}.dll). Also
the linker will use the appropriate library archive (msvcrt{*}.a).


No it doesn't.  -mthreads adds -lmingwthrd and defines _MT.

If you want to use -lpthread you have to add it specifically and do not use -mthreads.  That said, I don't know much more than that but -lmingwthrd was created for thread safety and exception handling for Windows thread model.  The -lpthread is not in the specs when you gcc -dumpspecs and the specs is the clue as to what command line options GCC adds to the sub-processes.

--
Earnie
-- https://sites.google.com/site/earnieboyd