root@testbed:/home/c/glibc/pthread#
root@testbed:/home/c/glibc/pthread# gcc -o exam1 exam1.c
/tmp/cc0sVwxh.o: In function `main':
/tmp/cc0sVwxh.o(.text+0x82): undefined reference to `pthread_create'
collect2: ld returned 1 exit status
root@testbed:/home/c/glibc/pthread#
제 생각엔 컴파일시에.. 라이브러리를 지정안해주셔서 발생한거 같습니다.
제 생각엔 컴파일시에.. 라이브러리를 지정안해주셔서 발생한거 같습니다. 똑같은 함수들은 포직스 함수기에.. 제공하고 있어요..
gcc -o 파일 파일.c -lpthread
해주셔야죠 ^^
root@testbed:/home/c/glibc/pthread# cat > exam1.c #include<stdio.h> #include<pthread.h> #define MAX 10 void *sub(void *tid){ printf("S[%d]\n", tid); pthread_exit(tid); } main(){ pthread_t thread[MAX]; int ret, t; for(t=0;t<MAX;t++){ printf("Create[%d]\n", t); pthread_create(&thread[t], NULL, sub, (void *)t); } pthread_exit(NULL); } root@testbed:/home/c/glibc/pthread# gcc -o exam1 exam1.c -lpthread root@testbed:/home/c/glibc/pthread# ls -al exam1 -rwxr-xr-x 1 root root 12565 2004-02-10 17:24 exam1 root@testbed:/home/c/glibc/pthread# ./exam1 Create[0] S[0] Create[1] S[1] Create[2] S[2] Create[3] S[3] Create[4] S[4] Create[5] S[5] Create[6] S[6] Create[7] S[7] Create[8] S[8] Create[9] S[9] root@testbed:/home/c/glibc/pthread#만약 안해주시면 라이브러리 참조못해서..
미참조 오류나요 아래처럼..
그럼.. ^^
힘내세요.
감사합니다 ^^
정말 감사합니다 ^^
깜빡했네요
다시한번 감사드립니다.
세상은 날 삼류라 하고 이 여자는 날 사랑이라 한다.
댓글 달기