linux 线程操作问题undefined reference to 'pthread_create'的解决办法(cmake)
问题原因:
pthread 库不是 Linux 系统默认的库,连接时需要使用静态库 libpthread.a.
所以在使用pthread_create()创建线程时,需要链接该库。
1. 终端:问题解决:
在编译中要加 -pthread参数
gcc thread.c -o thread -pthread
2. qt的cmake配置: 可以修改CMakeLists.txt:
Here is the right answer:
ADD_EXECUTABLE(your_executable ${source_files})
TARGET_LINK_LIBRARIES( your_executable
pthread
)
equivalent to
-pthread
linux 线程操作问题undefined reference to 'pthread_create'的解决办法(cmake)的更多相关文章
- Linux+CLion+树莓派远程编译时,Cmake编译出现undefined reference to 'pthread_create'的解决办法
		在CLion中开发讯飞的linux语音库时编译出现以下问题: undefined reference to 'pthread_create' CLion的cmake配置:修改CMakeLists.tx ... 
- Linux Ubuntu运行线程程序出现undefined reference to ‘pthread_create’和undefined reference to ‘pthread_join’错误。
		Linux Ubuntu运行线程程序出现undefined reference to ‘pthread_create’和undefined reference to ‘pthread_join’错误. ... 
- 问题:eclipse中线程编程编译报错,undefined reference to 'pthread_create'的解决方法(已解决)
		问题描述: 在Ubuntu系统中,使用eclipse CDT集成开发环境编写pthread程序,编译时,pthread_create不通过,报错信息是: undefined reference to ... 
- Linux下编译出现undefined reference to ‘pthread_create’问题解决
		1.代码 /* * File: HeartPackageSendAgent.cpp * Author: Pangxiaojian * * * 主要实现:向服务器发送心跳包,每5s向服务器发送一个心跳包 ... 
- Linux+CLion+树莓派远程编译时,Cmake编译出现undefined reference to 'dlopen'的解决办法
		在Clion中链接讯飞的语音库并传至树莓派上编译时,出现如下错误. undefined reference to `dlopen' undefined reference to `dlclose' u ... 
- 编译QT时出现lib/libQtGui.so: undefined reference to `ts_read_raw'的解决办法
		lib/libQtGui.so: undefined reference to `ts_read_raw' /lib/libQtGui.so: undefined reference to `ts_o ... 
- Linux 下编译出现   undefined reference to `pthread_create'
		这是由于没有链接线程库的原因,只要在编译的时候加入: -lpthread 参数即可. arm-linux-gcc serial.c -o serial -lpthread 查看 ubuntu 版本的命 ... 
- ubuntu 下没有pthread库以及报undefined reference to 'pthread_create'的解决方法
		https://blog.csdn.net/dyzhen/article/details/79058554 
- NDK 提示"undefined reference to xxx“的解决办法
		在Android.mk文件的 LOCAL_SRC_FILES后面加入包含该类或函数的文件,用\隔开,\后换行继续添加 例如 LOCAL_SRC_FILES := NDKTest.cpp\bncore. ... 
随机推荐
- Oracle Regexp_substr
			Oracle中REGEXP_SUBSTR函数 Oracle中REGEXP_SUBSTR函数的使用说明: 题目如下: 在oracle中,使用一条语句实现将'17,20,23'拆分成'17','2 ... 
- UNC path
			http://www.emailsignature.eu/phpBB2/how-to-get-a-unc-path-name-t341.html In a network, the Universal ... 
- (五)uboot移植补基础之shell
			1.shell介绍:shell是操作系统的终端命令行 (1)shell可以理解为软件系统提供给用户操作的命令行界面,可以说它是人机交互的一种方式.(2)我们可以使用shell和操作系统.uboot等软 ... 
- 【CDN】国外访问国内服务器网站-响应慢-CDN
			建议采用CDN海外加速方式: (1)CDN即内容分发网络(Content Delievery Network),它可以认为是建立在现有IP网络基础结构之上的一种增值网络.CDN技术将多点负载均衡.镜像 ... 
- 配置Linux任务计划
			Linux有三种计划任务: at:指定一个时间执行一个任务 (适用一个或多个任务,执行一次后就不用) cron:根据一个时间表自动执行任务 (使用一个或多个任务,周期性执行) 系统级别的计划任务及其扩 ... 
- Java troubleshooting guide
			http://www.oracle.com/technetwork/java/javase/toc-135973.html --不同的 OutOfMemoryError/内存溢出,以及相关的解决 
- VB6 GDI+ 入门教程[1] GDI+介绍
			http://vistaswx.com/blog/article/category/tutorial/page/2 VB6 GDI+ 入门教程[1] GDI+介绍 2009 年 6 月 18 日 17 ... 
- android 内存泄露之jni local reference table overflow (max=512)
			在android项目中要实现一个需求 为了性能的要求只能用c代码来实现功能. 这样就牺牲了java跨平台性. 通过加载.so的方式,把用c实现的模块集成到app中. android提供jni层,作为一 ... 
- linux笔记:shell基础和bash的基本功能
			shell的优势:可以直接调用linux系统命令 shell脚本的基本写法:脚本名以.sh结尾程序的第一行为#!/bin/bash,告诉系统这是一个shell脚本以#作为注释shell脚本的执行方式: ... 
- ubuntu修改更新源为163
			安装ubuntu后为了使下载及更新软件包更快,需要将自带的源更换为国内的源.以下以163为例: 1.首先备份下原始自带源: sudo cp sources.list /etc/apt/sources. ... 
