linux編程常見問題
来源:互联网 发布:淘宝助理销售属性 编辑:程序博客网 时间:2024/06/07 03:22
1.undefined reference to 'pthread_create'问题解决
问题原因:
pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a,所以在使用pthread_create()创建线程,以及调用 pthread_atfork()函数建立fork处理程序时,需要链接该库。
问题解决:
a. 在编译中要加 -lpthread参数
gcc thread.c -o thread -lpthread
thread.c为你些的源文件,不要忘了加上头文件#include<pthread.h>
b.在Code::Block中,則需要鏈接libpthread.so.位置在project's build options -> linker settings.
c.unbuntu中.没有libpthread.so,有也是带版本号的.
只有/lib/x86_64-linux-gnu/libpthread-2.13.so
和做的符号链接/lib/x86_64-linux-gnu/libpthread.so.0
0 0
- linux編程常見問題
- linux
- linux
- Linux
- Linux
- LINUX!
- Linux
- linux
- linux
- linux
- Linux
- linux
- linux
- linux
- linux
- Linux
- linux
- linux
- 使用存储过程和Event事件为Mysql表自动建立分区
- ios ---12306学习
- 如何在Eclipse4.3(Kepler)中安装Clover2.4.2?
- 怎样保存kernel crash dump 文件
- 说说细胞统计那些事
- linux編程常見問題
- php不用编译增加openssl的方法
- 哈希表的应用-浅析顶点聚簇网格简化算法的实现
- 牛樟
- Linux下正确编译jar的方法
- HTML5之语音识别实例
- 关于C#算术运算符的问题
- HTTP Get与Post的区别
- python 去除html标签的几种方法