I just moved to Linux world from Windows. everything is new to me because the environment is so different.
Anyway, I am studying APUE book and tried to compile mutilthread code with gcc.
The code uses pthread_create
function and includes pthread.h
I got the error message that pthread_create
function is not declared although I included <pthread.h>
I googled it and got the answer that is putting the option -pthread
on when I compile.
like gcc -pthread blah.c
Then it compiles and works fine.
But I wonder what -pthread
actually does. and why I have to do this although I include "pthread header file"
Thanks!