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