makefile的杂七杂八
来源:互联网 发布:史蒂芬库里 知乎 编辑:程序博客网 时间:2024/05/29 02:50
-fPIC -shared
生成动态链接库 .so
ar rc
生成静态连接库 .a
参数:“-I”(大写i),“-L”(大写l),“-l”(小写l)
例: gcc -o hello hello.c -I /home/hello/include -L /home/hello/lib -lworld
表示在编译hello.c时:
-I /home/hello/include表示将/home/hello/include目录作为第一个寻找头文件的目录,寻找的顺序是:/home/hello/include-->/usr/include-->/usr/local/include
-L /home/hello/lib表示将/home/hello/lib目录作为第一个寻找库文件的目录,寻找的顺序是:/home/hello/lib-->/lib-->/usr/lib-->/usr/local/lib
-lworld表示在上面的lib的路径中寻找libworld.so动态库文件(如果gcc编译选项中加入了“-static”表示寻找libworld.a静态库文件)
关于 -pthread
和-lpthread
$ man gcc | grep pthread -mvxworks -G num -pthread -mno-unaligned-doubles -mv8plus -mno-v8plus -mvis -mno-vis -threads -pthreads -pthread implies -pthread, and thus is only supported on targets that have support for -pthread. implies -pthread, and thus is only supported on targets that have support for -pthread. option and the -pthread option are incompatible. -pthread Adds support for multithreading with the pthreads library. This option sets flags for -pthreads -pthread This is a synonym for -pthreads. $ man gcc | grep lpthread $
gcc 4.5.2中已经没有了关于 -lpthread的介绍了。所以以后的多线程编译应该用-pthread,而不是-lpthread。
阅读全文
0 0
- makefile的杂七杂八
- MakeFile 杂七杂八
- 杂七杂八的
- 杂七杂八的
- 杂七杂八的
- .net的风风雨雨---杂七杂八
- 杂七杂八的东西
- JavaScript的杂七杂八
- SSH的杂七杂八
- 一些杂七杂八的笔记
- 杂七杂八的杂记
- 一些杂七杂八的东西
- 杂七杂八的小笔记
- SPRING相关的杂七杂八
- 杂七杂八的东西
- 杂七杂八的小知识点
- 杂七杂八的东西
- 【杂七杂八】大四的反思
- QTableWidgetItem
- Java的三种代理模式
- LateUpdate以及Update的区别
- Java代码优化必看
- 设计23式—策略
- makefile的杂七杂八
- studio 更新到3.0后报错问题及解决方案
- 2.判断是否是制单人
- 2012年系统架构师考试题详解
- TOP100summit:【分享实录-美团点评】 业务快速升级发展背后的系统架构演进
- 什么是跨域?怎么解决跨域问题?
- BZOJ1798: [Ahoi2009]Seq 维护序列seq
- 查询上周同天的指标数据(查小时表)
- UVA 10003