If you are going to compile a C program with pthread.h in LINUX using GCC or G++ you will have to use –lpthread option after the compile command.

gcc xyz.c -o xyz -lpthread

Here,

gcc is compiler command (compiler name)

xyz.c is a source file name.

-o is an option to create objcect file.

xyz is the name of object (binary) file.

-lpthread is an option for pthread.h

for more details here is the link conatining complete article on it.

Compiling C program with pthread.h in Linux.

pthread库不是 Linux 默认的库,有些 Library 默认使用pthread但是在介绍的时候没有说明,导致编译时出错。-lpthread-pthread两种写法好像都可以。

最新文章

  1. 【Beta】用户问题反馈及处理(一直更新)
  2. 【思路】-分页-双top分页算法的原理
  3. 学习日记-发布第一篇WordPress
  4. Bootstrap~Panel和Table
  5. 你应该知道的10个奇特的 HTML5 单页网站
  6. 【代码笔记】iOS-带输入框的UIAlertView
  7. 启用Service Broker
  8. PostgreSQL连接python,postgresql在python 连接,创建表,创建表内容,插入操作,选择操作,更新操作,删除操作。
  9. ZOJ 1201 Inversion
  10. 【阿里云产品公测】以开发者角度看ACE服务『ACE应用构建指南』
  11. Cent Os 常用操作
  12. SQL 返回数量一定的行
  13. MySql5压缩包安装
  14. 使用javascript把图片转成base64位编码,然后传送到服务端(ajax调用的接口基于drupa7)
  15. hdu4586(概率、期望)
  16. iOS开发自定义流水布局
  17. Java IO编程全解(一)——Java的I/O演进之路
  18. java 集合框架(十四)Queue
  19. vue-cli环境配置
  20. Gradle 打多渠道包

热门文章

  1. layer系列之弹层layer.prompt
  2. Java实体类之间的映射(一对多关系)
  3. Stream 源码分析
  4. LongAccumulator 源码分析
  5. 无障碍(Accessible Rich Internet Applications)
  6. 封装redis(set/get/delete)str和哈希类型
  7. Series.str方法
  8. 字符串 字符数组, pcha string 之间的相互转化, 很重要。 很蛋疼
  9. Hibernate的批量抓取
  10. Vue 基础 day01