Difference between -pthread and -lpthread while compiling

后端 未结 3 1979
面向向阳花
面向向阳花 2020-11-22 14:23

What is the difference between gcc -pthread and gcc -lpthread which is used while compiling multithreaded programs?

3条回答
  •  猫巷女王i
    2020-11-22 14:54

    -pthread Adds support for multithreading with the pthreads library. This option sets flags for both the preprocessor and linker (man gcc).

    while

    -lpthread comes in existence while linking there will be no influence while preprocessing.

提交回复
热议问题