Do I need -D_REENTRANT with -pthreads?

后端 未结 3 450
你的背包
你的背包 2020-12-02 10:34

On Linux (kernel 2.6.5) our build system calls gcc with -D_REENTRANT.

Is this still required when using pthreads?

3条回答
  •  长情又很酷
    2020-12-02 11:19

    For me the best answer was the comment from pts if only he bothered to submit it as answer:

    You investigated properly and answered your own question. Use g++ -pthread, it is equivalent to g++ -lpthread -D_REENTRANT. Using g++ -D_REENTRANT would be different, it may not set all the linker flags. – pts May 18 at 0:30

提交回复
热议问题