What is the difference between gcc -pthread and gcc -lpthread which is used while compiling multithreaded programs?
gcc -pthread
gcc -lpthread
-pthread Adds support for multithreading with the pthreads library. This option sets flags for both the preprocessor and linker (man gcc).
-pthread
man gcc
while
-lpthread comes in existence while linking there will be no influence while preprocessing.
-lpthread