스레드 생성이 안되요 ㅡ ㅡ

sysmoon의 이미지

..그 외에 필요한 헤더 파일
#inlcude<pthread.h>

void *thread_function(void *arg);

int main(int argc,char **argv){
 int state;
 pthread_t t_id;
 void *t_return;

 state = pthread_create(&t_id,NULL,thread_function,NULL);
}

void *thread_function(void *arg){
 puts("스레드가 생상되었습니다. \n");
}

컴파일 하면 undefined referenced to "pthread_create"라고 나옵니다.
우짜된거죠? tcp/ip열혈강의 윤성우 저자님 책 예제입니다.
불필요한 코드는 여기서 뺐고요..
헤더파일 빠진거 없는데.. 쩝..

컴파일은 gcc사용했고요..

sysmoon의 이미지

앗 죄송 책 보니 컴파일을 그냥 cc -o thread1 thread1.c 하면 안되는군요 옵션을 주니깐 컴파일 잘 되네요 ㅡ ㅡ

AirPlug