长江石油:undefined reference to 'pthread
来源:百度文库 编辑:九乡新闻网 时间:2024/05/02 02:12:16
由于是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
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
undefined reference to 'pthread
undefined reference to rpl
pthread
C++ Reference [C++ Reference]
Git Reference
Finance.Reference
const reference和nonconst reference
转贴: pthread 解读 (一)
OSI reference model
Bash Reference Manual:
linux下C/C++,多线程pthread
Reference from another team-building perspective
To pray, to spread
linux多线程的总结(pthread用法) - 红联Linux门户 - 中国领先的Lin...
新闻图集_新闻台_中国网络电视台#g=undefined&p=10323101631
人人必读★救命法宝《中医急救法汇编??url=undefined!
新闻图集_新闻台_中国网络电视台#g=undefined&p=10611100153
有关ccs2.2程序移植到ccs3.3undefined symbol __strasgi
C 中Reference与指针(Pointer)的使用对比 - wu928320442的专栏 - CSDN博客
MySQL :: MySQL 5.0 Reference Manual :: 11.17.2 DECIMAL Data Type Changes
to to 还是 for for
To Cure Sometimes, To Relieve Often, To Comfort Always
To Cure Sometimes, To Relieve Often, To Comfort Always
Taxpayers-to-retiree ratio to approach 1-to-1...