解决undefined reference to `pthread_create'的问题
来源:互联网 发布:程序员相亲小品 编辑:程序博客网 时间:2024/06/07 03:52
由于是Linux新手,所以现在才开始接触线程编程,照着GUN/Linux编程指南中的一个例子输入编译,结果出现如下错误:
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_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>
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' 问题
- QT多线程中undefined reference to 'pthread_create'错误的解决
- 解决QT多线程中undefined reference to 'pthread_create'的错误
- linux 下 C 语言 编程 undefined reference to 'pthread_create'问题的解决
- QT2.2.0中多线程中遇到undefined reference to `pthread_create'问题的解决
- thread_join.c:(.text+0x6f): undefined reference to `pthread_create' 问题的解决
- 关于线程编程中“undefined reference to 'pthread_create'等问题的解决
- 解决Netbeans 下 undefined reference to `pthread_create'
- 关于undefined reference to `pthread_create'\`pthread_join'的问题。
- undefined reference to 'pthread_create'
- undefined reference to 'pthread_create'
- undefined reference to 'pthread_create'
- Junit4,Spring集成测试配置
- hdu1290:献给杭电五十周年校庆的礼物
- LeetCode 46 Permutations II
- ubuntu 12.04 LTS 安装配置JDK1.8.0
- Lua性能优化
- 解决undefined reference to `pthread_create'的问题
- setInterval 有参数定时执行
- DSP/BIOS使用之初窥门径——滴答时钟及烧写Flash
- Java中将上传的文件首页生成缩略图(先将上传的文件转成pdf,然后将pdf转成jpg)
- c#中用DirectShow实现媒体播放器的核心(1) DirectShow简介
- 也谈配置管理团队的建设
- PCB设计资料:看到最后才知道是福利
- 如何处理Windows Forms程序中未处理的异常
- hive学习之基本语法篇(一)