undefined reference to 'pthread_create'问题解决
2016-06-01 14:14
531 查看
undefined reference to 'pthread_create'
undefined reference to 'pthread_join'
问题原因:
pthread
库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立fork处理程序时,需要链接该库。
问题解决:
在编译中要加 -lpthread参数
gcc thread.c -o thread -lpthread
thread.c为你些的源文件,不要忘了加上头文件#include<pthread.h>
undefined reference to 'pthread_join'
问题原因:
pthread
库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立fork处理程序时,需要链接该库。
问题解决:
在编译中要加 -lpthread参数
gcc thread.c -o thread -lpthread
thread.c为你些的源文件,不要忘了加上头文件#include<pthread.h>
相关文章推荐
- Ext JS 6开发实例(四) :调整主视图
- javascript 数组排序sort方法和自我实现排序方法的学习小结 by FungLeo
- java 并发实践 - Chapter 2(Thread Safety) 笔记
- CSS清浮动处理(Clear与BFC)
- 通过offset值的设置使html元素对齐
- CSS中表示cellpadding和cellspacing的方法
- jquery获取复选框的值
- 纯css九宫格布局排版
- 跟着9张思维导图学习Javascript
- Twitter bootstrap模糊查询插件 ajax获取内容
- Yaf之配置和Bootstrap
- Fedora 17 开启ssh服务
- 10款让WEB前端开发人员更轻松的实用工具
- JavaScript:对象和数组
- javascript 从一组数据中找到指定的单条数据的方法 by FungLeo
- JavaScript脚本语言
- Bootstrap 排版
- sencha ext js 6 入门
- 关于layer.js中layer.confirm弹出框看不到或者不居中问题处理
- jsp中文乱码