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.
CC is the name given to the UNIX Compiler Command. It is used as the default compiler command for your operating system and also is executable with the same command. GCC, on the other hand, is the GNU Compiler operating system.
The term gcc may still sometimes refer to the "GNU C Compiler" in the context of C programming. man gcc # GCC(1) GNU # # NAME # gcc - GNU project C and C++ compiler. However, g++ is the C++ compiler for the GNU Compiler Collection. Like gnat is the Ada compiler for gcc . see Using the GNU Compiler Collection (GCC)
GCC is an integrated distribution of compilers for several major programming languages. These languages currently include C, C++, Objective-C, Objective-C++, Java, Fortran, and Ada.
The Solaris -pthreads
and Linux -pthread
options do equivalent things. Apparently, gcc-4.x
series accepts -pthread
for Solaris as well.
You do want the -pthread
/-pthreads
option while compiling because it adds multithreading support in the preprocessor and the linker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With