线程编译问题(undefined reference to `pthread_create')
来源:互联网 发布:花返网络股份有限公司 编辑:程序博客网 时间:2024/06/10 05:30
[root@localhost pthread]# gcc test.c -o test
/tmp/ccq2Mbxs.o: In function `main':
test.c:(.text+0x89): undefined reference to `pthread_create'
collect2: ld 返回 1
[root@localhost pthread]#
问题原因:
pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立fork处理程序时,需要链接该库。
问题解决:
在编译中要加 -lpthread参数
gcc test.c -o test -lpthread
转自:http://blog.csdn.net/silentpebble/article/details/6906117
0 0
- 线程编译问题(undefined reference to `pthread_create')
- 线程编译问题(undefined reference to `pthread_create')
- 线程编译问题(undefined reference to `pthread_create')
- 线程库编译问题: undefined reference to 'pthread_create'的解决
- (转)undefined reference to 'pthread_create'问题
- undefined reference to 'pthread_create' 问题
- 线程程序编译出错 undefined reference to `pthread_create'
- apue 线程代码编译时的 undefined reference to 'pthread_create' 问题处理
- linux 创建线程问题undefined reference to 'pthread_create'
- gcc编译线程程序需带-lpthread选项(否则出错:undefined reference to `pthread_create')
- 线程异常:undefined reference to 'pthread_create' 处理
- 编译时报错:undefined reference to `pthread_create’
- 编译错误----undefined reference to 'pthread_create'问题解决
- undefined reference to 'pthread_create'
- undefined reference to 'pthread_create'
- undefined reference to 'pthread_create'
- undefined reference to `pthread_create'
- undefined reference to `pthread_create'
- 程序员如何管理自己的代码
- Android一点 精简google-play-services.jar
- 妙算(树莓派等linux系统)程序开机自启动
- iOS使用HTTPS
- TCP运输连接管理
- 线程编译问题(undefined reference to `pthread_create')
- css强制换行、超出隐藏和限制行数
- mysql创建定时器(event),查看定时器,打开定时器,设置定时器时间
- Bootstrap3 表格-带边框的表格
- 第十三周项目2-Kruskal算法的验证
- Javaweb中JavaScript的变量声明
- /usr/lib64/libstdc++.so.6: undefined reference to `memcpy@GLIBC_2.14'
- hadoop环境搭建之配置SSH免密码登录
- ubuntu14.04下deb文件安装mysql数据库