在使用线程时,使用gcc或arm-linux-gcc编译时,会出现错误:undefined reference to 'pthread_create'

主要是以下两种原因:

1、#include <pthread.h>  请确认头文件是否添加

2、-lpthread 编译选项,即在编译时需添加额外的编译选项,如使用arm-linux-gcc编译lc300-led-test.c文件,命令正确应该如下:

arm-linux-gcc -o lc300-led-test lc300-led-test.c -lpthread

请注意后面的-lpthread,特别是-后边的'l',link = 'l'

(笔记)Linux线程编译undefined reference to 'pthread_create'的更多相关文章

  1. 在linux下编译线程程序undefined reference to `pthread_create'

    由于是Linux新手,所以现在才开始接触线程编程,照着GUN/Linux编程指南中的一个例子输入编译,结果出现如下错误:undefined reference to 'pthread_create'u ...

  2. Linux Ubuntu运行线程程序出现undefined reference to ‘pthread_create’和undefined reference to ‘pthread_join’错误。

    Linux Ubuntu运行线程程序出现undefined reference to ‘pthread_create’和undefined reference to ‘pthread_join’错误. ...

  3. Linux下编译出现undefined reference to ‘pthread_create’问题解决

    1.代码 /* * File: HeartPackageSendAgent.cpp * Author: Pangxiaojian * * * 主要实现:向服务器发送心跳包,每5s向服务器发送一个心跳包 ...

  4. 问题:eclipse中线程编程编译报错,undefined reference to 'pthread_create'的解决方法(已解决)

    问题描述: 在Ubuntu系统中,使用eclipse CDT集成开发环境编写pthread程序,编译时,pthread_create不通过,报错信息是: undefined reference to ...

  5. Linux+CLion+树莓派远程编译时,Cmake编译出现undefined reference to 'pthread_create'的解决办法

    在CLion中开发讯飞的linux语音库时编译出现以下问题: undefined reference to 'pthread_create' CLion的cmake配置:修改CMakeLists.tx ...

  6. Linux下undefined reference to ‘pthread_create’问题解决

    Linux下undefined reference to 'pthread_create'问题解决 在试用Linux 线程模块时,试用pthread_create 函数. 编译命令为 gcc main ...

  7. Linux下undefined reference to ‘pthread_create’问题解决 zz

    接触了Linux系统编程中的线程编程模块,可gcc sample.c(习惯把书上的sample代码写进sample.c文件中)出现“undefined reference to ‘pthread_cr ...

  8. undefined reference to `pthread_create'问题解决

    在编译pthread有关的程序时,出现undefined reference to `pthread_create'这样的错误. 问题原因: pthread 库不是 Linux 系统默认的库,连接时需 ...

  9. undefined reference to 'pthread_create'问题解决 -- 转

    文章出处:http://blog.csdn.net/llqkk/article/details/2854558 由于是Linux新手,所以现在才开始接触线程编程,照着GUN/Linux编程指南中的一个 ...

随机推荐

  1. nfs 客户端启动报错rpc.mountd: svc_tli_create: could not open connection for tcp6

    # /etc/init.d/nfs start Starting NFS services: [ OK ] Starting NFS mountd: rpc.mountd: svc_tli_creat ...

  2. how-apache-flink-enables-new-streaming-applications-part-1

    https://data-artisans.com/blog/how-apache-flink-enables-new-streaming-applications-part-1 http://www ...

  3. Leetcode:Longest Substring Without Repeating Characters 解题报告

    Longest Substring Without Repeating Characters Given a string, find the length of the longest substr ...

  4. Lintcode: Fast Power 解题报告

    Fast Power 原题链接:http://lintcode.com/en/problem/fast-power/# Calculate the an % b where a, b and n ar ...

  5. 【Python学习笔记】-冒泡排序、插入排序、二分法查找

    原文出处:https://blog.csdn.net/yort2016/article/details/68065728 冒泡排序 主要是拿一个数与列表中所有的数进行比对,若比此数大(或者小),就交换 ...

  6. jetty debug修改 java static 静态变量值不会生效

    在jetty debug模式下修改static静态变量值不会重新Load 因为jetty是嵌入式web容器,static静态变量是全局的,如果想生效,就必须重启jetty 在热部署的时候tomcat会 ...

  7. model number

    // test.cpp : Defines the entry point for the console application. // #include "stdafx.h" ...

  8. 4. 文本相似度计算-CNN-DSSM算法

    1. 文本相似度计算-文本向量化 2. 文本相似度计算-距离的度量 3. 文本相似度计算-DSSM算法 4. 文本相似度计算-CNN-DSSM算法 1. 前言 之前介绍了DSSM算法,它主要是用了DN ...

  9. mysql-connector-java-5.1.22下载

    java连接mysql时,需要安装驱动.如果未安装,会出现找不到“com.mysql.jdbc.Driver”的错误. 最新版驱动是:mysql-connector-java-5.1.22 下载地址: ...

  10. virtualbox问题收集

    The VM session was closed before any attempt to power it on. 返回 代码:E_FAIL (0x80004005)组件:SessionMach ...