I have a pthreads program. I have to compile it with gcc -pthread in Linux (-pthreads is unrecognized option) and gcc -pthreads in Sun (-pthread is unrecognized option). Why the difference, since it’s the same compiler? However, -lpthread works on both, but I heard this isn’t always sufficient.
Share
The Solaris
-pthreadsand Linux-pthreadoptions do equivalent things. Apparently,gcc-4.xseries accepts-pthreadfor Solaris as well.You do want the
-pthread/-pthreadsoption while compiling because it adds multithreading support in the preprocessor and the linker.