I am unsure about the compiler switches required for a pthreads application on Solaris 10 (Studio 12 compilers). The compiler man pages suggest using "-mt" when compiling to objects and "-mt -lpthread" when linking.
On the other hand, the Multithreaded Programming Guide states that from Solaris 10 on everything required is in libc, which could mean that compiling everything with -D_REENTRANT and linking without any switches related to threading might be sufficient.
The man page for CC says that libCrun needs -lthread, and therefore -lmt -lpthread is required, which confuses me.
Releases of Studio generally support multiple versions of Solaris, so the advice in the C++ Users Guide provides guidance on what will work on all supported platforms.
When compiling with CC, or when linking an executable program using CC, you need -mt but not -lthread.
When linking a shared library, no libraries are linked by default. You need to list explicitly every library that the shared library needs. In that case, you would need to add -lthread.
If you link explicitly using ld instead of CC you must list all needed libraries. We strongly recommend against linking C++ programs using ld, because the command line needed depends on the CC options, and is difficult to get it right.
For Posix threads, in general you need to add -lpthread, since pthreads are not the default.
But as Darryl points out, on Solaris 10 and 11 the thread and pthread libraries are part of libc, so you don't need to list them.