Reputation: 21
I get undefined reference to `pthread_atfork' even after using pthread library. Is there any separate library for this?
Upvotes: 2
Views: 10095
Reputation: 2682
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
Upvotes: 1
Reputation: 27900
pthread_atfork() is part of the POSIX spec, so it should be there in the regular pthread library.
You may have to specify options to both the compiler & linker to build with pthreads. For example, with gcc/linux:
-pthread
Adds support for multithreading with the pthreads library. This option sets flags for both the
preprocessor and linker.
Upvotes: 2