[转] boost undefined reference to 'pthread_create 问题
由于是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>
http://blog.csdn.net/llqkk/article/details/2854558
[转] boost undefined reference to 'pthread_create 问题的更多相关文章
- undefined reference to `pthread_create'问题解决
在编译pthread有关的程序时,出现undefined reference to `pthread_create'这样的错误. 问题原因: pthread 库不是 Linux 系统默认的库,连接时需 ...
- Linux下undefined reference to ‘pthread_create’问题解决
Linux下undefined reference to 'pthread_create'问题解决 在试用Linux 线程模块时,试用pthread_create 函数. 编译命令为 gcc main ...
- undefined reference to `pthread_create'
问题描述: ubuntu 16.04 下 C语言开发环境, 已经添加了头文件#include <pthread.h> 以及在Makefile中添加了 -lpthread,但是编译时仍然 ...
- pytorch安装 caffe2 安装:git 慢 caffe2 cannot find -lopencv_dep_cudart ,undefined reference to 'pthread_create'
最开始的问题: caffe2目前已经不维护了.怎么编译都报错,并且有third_party的代码链接已经飞了.下载不全代码了.建议 不要再折腾了,直接安装Pytorch. 首先,基本环境是ubuntu ...
- (笔记)Linux线程编译undefined reference to 'pthread_create'
在使用线程时,使用gcc或arm-linux-gcc编译时,会出现错误:undefined reference to 'pthread_create' 主要是以下两种原因: 1.#include &l ...
- FreeModbus undefined reference to `pthread_create'
/********************************************************************************* * FreeModbus unde ...
- undefined reference to 'pthread_create'问题解决 -- 转
文章出处:http://blog.csdn.net/llqkk/article/details/2854558 由于是Linux新手,所以现在才开始接触线程编程,照着GUN/Linux编程指南中的一个 ...
- 在linux下编译线程程序undefined reference to `pthread_create'
由于是Linux新手,所以现在才开始接触线程编程,照着GUN/Linux编程指南中的一个例子输入编译,结果出现如下错误:undefined reference to 'pthread_create'u ...
- Linux下undefined reference to ‘pthread_create’问题解决 zz
接触了Linux系统编程中的线程编程模块,可gcc sample.c(习惯把书上的sample代码写进sample.c文件中)出现“undefined reference to ‘pthread_cr ...
随机推荐
- Dart编程实例 - HelloWorld
Dart编程实例 - HelloWorld void main() { print('hello world'); } 本文转自:http://codingdict.com/article/23399
- bzoj 1095
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1095 首先我必须得感谢yzjc的细心讲解和某岛的题解,如果没有的话我相信我现在还在纠结..不 ...
- PHP ftp_get() 函数
定义和用法 ftp_get() 函数从 FTP 服务器上下载一个文件并保存到本地一个文件中. 如果成功,该函数返回 TRUE.如果失败,则返回 FALSE. 语法 ftp_get(ftp_connec ...
- 构造——cf1214E
首先定义三元组(2*i-1,2*i,d),将n个三元组按d降序排列,然后取每个三元组的2*i-1连在一起,构成一条长为n-1的链 然后降序枚举每个三元组,把对应的2*i在链上合法的位置接上, 能保证一 ...
- 网格图必经点+dfs——cf1214D
先正着走一次把所有可行路径标记出来,然后倒着走两条路径,一条是能向下就向下的路径,另一条能向右就向右. 如果这两条路径相交,那么(1,1)-(n,m)路径上比有个必经点,把这个必经点封上,答案是1,如 ...
- 浏览器表单默认记忆功能input的 autocomplete="off"属性
一般情况下浏览器会有自动记录密码等的功能,但是有时候我们不需要这样的功能,下面有两种情况下关闭记忆功能有效: 1:在form中,如果有input[type=password],autocomplete ...
- BZOJ 2005: [Noi2010]能量采集(容斥+数论)
传送门 解题思路 首先题目要求的其实就是\(\sum\limits_{i=1}^n \sum\limits_{j=1}^m [(gcd(i,j)-1)*2+1)]\),然后变形可得\(-n*m+2\s ...
- nginx,php-fpm性能优化
When you running a highload website with PHP-FPM via FastCGI, the following tips may be useful to yo ...
- 20165239 2018——2019Exp8 Web基础
Exp8 Web基础 基础问题回答 (1)什么是表单 •表单在网页中主要负责数据采集功能. •一个表单有三个基本组成部分: ◦表单标签,这里面包含了处理表单数据所用CGI程序的URL以及数据提交到服务 ...
- JAVA单元测试的用法和要点(入门篇)
一.单元测试的目的? 单元测试是编写测试代码,用以检测特定的.明确的.细颗粒的功能! 严格来说,单元测试只针对功能点进行测试,不包括对业务流程正确性的测试.现在一般公司都会进行业务流程的测 ...