原文:Ubuntu使用多线程cmake时出现undefined reference to `pthread_create'

原因是ubuntu需要查找Threads第三方库,不能直接使用,因此,在cmakelists.txt文件中添加以下两行代码就ok ...

2019-05-03 21:50 0 547 推荐指数:

查看详情

CMake时报undefined reference to `pthread_create'错误

今天自己用CMake搭建一个项目,其中用到了多线程 在make的时候报了 undefined reference to `pthread_create'这个错误,网上很多都是说lpthread 不是linux下默认的库之类的。 只需要在编译的时候加上-lpthread参数。虽然可以解决问题 ...

Tue Aug 11 18:30:00 CST 2020 0 673
undefined reference to `pthread_create'

问题描述: ubuntu 16.04 下 C语言开发环境, 已经添加了头文件#include <pthread.h> 以及在Makefile中添加了 -lpthread,但是编译仍然报错: undefined reference to `pthread_create ...

Fri Feb 22 18:50:00 CST 2019 0 911
(笔记)Linux线程编译undefined reference to 'pthread_create'

使用线程使用gcc或arm-linux-gcc编译,会出现错误:undefined reference to 'pthread_create' 主要是以下两种原因: 1、#include <pthread.h> 请确认头文件是否添加 2、-lpthread ...

Mon Dec 08 20:03:00 CST 2014 0 3791
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM