Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined Reference to `pthread_init' When Using -lpthread Flag:

I'm compiling using:

gcc -o outfile infile.c -lpthread

and the only undefined reference is pthread_init.

I have tried using -pthread instead of -lpthread, as per some suggestions online.

I am including <pthread.h>

Any ideas?

like image 799
Zéychin Avatar asked Sep 23 '26 19:09

Zéychin


1 Answers

Don't call pthread_init(). It's not necessary on Linux.

like image 82
Michael Burr Avatar answered Sep 26 '26 08:09

Michael Burr