织梦CMS - 轻松建站从此开始!

罗索

Linux如何生成.a文件

罗索客 发布于 2007-06-08 13:26 点击:次 
.a文件是静态库文件,他是很多个.o文件的集合。 例如:cnapsapi.a: $(APPOBJ)/cnapsapi.o $(APPOBJ)/queue.o ar -r $(APPOBJ)/cnapsapi.a $(APPOBJ)/cnapsapi.o $(APPOBJ)/queue.o 意思就是说把cnapsapi.o,queue.o两个文件生成一个cnapsapi.a静态库文件。 多谢,
TAG:

.a文件是静态库文件,他是很多个.o文件的集合。
例如:cnapsapi.a: $(APPOBJ)/cnapsapi.o $(APPOBJ)/queue.o
ar -r $(APPOBJ)/cnapsapi.a $(APPOBJ)/cnapsapi.o $(APPOBJ)/queue.o

意思就是说把cnapsapi.o,queue.o两个文件生成一个cnapsapi.a静态库文件。

多谢,那我要是在编译另一个.c文件的时候需要使用这个.a文件,gcc里应该加什么参数阿
加入-l 参数啊,
Linking is always the last stage unless you use one of the
-c, -S, or -E options to avoid it (or unless compilation
errors stop the whole process). For the link stage, all
.o files corresponding to source files, -l libraries,
unrecognized filenames (including named .o object files
and .a archives) are passed to the linker in command-line
order.

(iwgh)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/200706/6720.html]
本文出处: 作者:iwgh
顶一下
(1)
50%
踩一下
(1)
50%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容