1

即使在使用 pthread 库之后,我也会得到对“pthread_atfork”的未定义引用。是否有任何单独的图书馆?

4

2 回答 2

2

pthread_atfork() 是 POSIX 规范的一部分,因此它应该存在于常规 pthread 库中。

您可能必须为编译器和链接器指定选项才能使用 pthread 构建。例如,使用 gcc/linux:

-pthread
       Adds support for multithreading with the pthreads library.  This option sets flags for both the
       preprocessor and linker.
于 2010-03-03T16:49:10.253 回答
1

If you are building for Android, then pthread_atfork() is not included in Bionic libc. Check out this question for more information:

"undefined reference to pthread_atfork" while I was trying to port libpcsclite to Android

于 2013-12-06T01:31:28.760 回答