using thread with gcc on fedora [undefined reference to pthread_create]

Markku Kolkka markkuk at tuubi.net
Wed Jul 19 14:01:03 UTC 2006


Abid Ghufran kirjoitti viestissään (lähetysaika keskiviikko, 19. 
heinäkuuta 2006 16:44):
> When i try to compile the code, the gcc says that the
> "pthread_create" is an undefined reference. I have included
> the library pthread.h. Is there something else that i need to
> do.

pthread.h isn't a library, it's a header file that declares the 
functions in the pthread library. You must add the actual 
library to your program with the -lpthread linker option.

-- 
 Markku Kolkka
 markku.kolkka at iki.fi




More information about the users mailing list