2012-07-14 2 views
3

다음은 빌드 로그입니다. 누구든지 도와 줄 수 있습니까?`pthread_key_create '에 대한 정의되지 않은 참조

gcc -DHAVE_CONFIG_H -DHAVE_VERSION_H -DLIBRARY_DIR="\"/usr/local/lib\"" -DSBIN_DIR="\"/usr/local/sbin\"" -I. -I.. -I../zmq/include -g -D_REENTRANT -D__EXTENSIONS__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES -g -O2 -w -pedantic -std=gnu99 -I../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/include -c -o dbtool.o dbtool.c 
gcc -o dbtool dbtool.o -g -O2 -Wall -W -Wshadow -pedantic -std=gnu99 -Wl,--export-dynamic -ldl -lpthread -lstdc++ -lrt -luuid -L../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib -lmysqlclient -lm 
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_global_init': 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:121: undefined reference to `pthread_key_create' 
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_init': 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:317: undefined reference to `pthread_getspecific' 
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_global_init': 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:335: undefined reference to `pthread_setspecific' 
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_destroy_mutex': 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:260: undefined reference to `pthread_getspecific' 
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_init': 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:317: undefined reference to `pthread_getspecific' 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:335: undefined reference to `pthread_setspecific' 
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_end': 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:374: undefined reference to `pthread_getspecific' 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:422: undefined reference to `pthread_setspecific' 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:407: undefined reference to `pthread_setspecific' 
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `_my_thread_var': 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:428: undefined reference to `pthread_getspecific' 
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `my_thread_var_mutex_in_use': 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:446: undefined reference to `pthread_getspecific' 
../../mysql-connector-c-6.0.2-linux-glibc2.3-x86-32bit/lib/libmysqlclient.a(my_thr_init.c.o): In function `_my_thread_var': 
/export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_thr_init.c:428: undefined reference to `pthread_getspecific' 
+3

GCC에서'-lpthread' 대신'-pthread'를 사용하길 원했습니다. – Flexo

+0

감사의 말로 flexo 문제가 해결되었습니다. – sureone

답변

3

당신은 종속성을 소개 MySQL의 라이브러리 이후의 pthreads 라이브러리 을 지정해야합니다. 링크 문은 왼쪽에서 오른쪽으로 구문 분석됩니다. 종속성을 가져 오는 객체 앞에 라이브러리를 지정하면 해당 객체는 버려집니다.

+0

감사합니다 talonmise, 작동합니다. – sureone

관련 문제