首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未定义对`pthread_key_create‘的引用

未定义对`pthread_key_create‘的引用
EN

Stack Overflow用户
提问于 2012-07-14 17:05:49
回答 1查看 8.2K关注 0票数 3

这是构建日志,有人能帮上忙吗?

代码语言:javascript
复制
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'
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-14 17:19:42

您需要在引入依赖项的mysql库之后指定pthread库。链接语句是从左到右解析的,如果你在引入依赖关系的对象之前指定库,它将被丢弃。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11482445

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档