- 6
- 0
- 约8.33千字
- 约 9页
- 2016-11-28 发布于河南
- 举报
使用Automake生成Makefile及动态库和静态库的创建
使用Automake生成Makefile及动态库和静态库的创建
使用Automake 创建和使用静态库
1. 目录结构如下:
[c-sharp]?view plaincopy
example??
|——src?目录(存放源代码文件)??
????????|——hello.c??
|——lib?目录(存放用来生成库的文件)??
????????|——test.c?用来生成静态库libhello.a??
|——include?目录(存放程序中使用的头文件)??
????????|——hello.h??
2. 编写的各个目录下的源文件
[c-sharp]?view plaincopy
hello.h?文件??
extern?void?print(char?*);??
test.c?文件??
#includestdio.h??
void?print(char?*msg)??
{??
print(“%s/n”,?msg);??
}??
hello.c?文件??
#include?“hello.h”??
int?main()??
{??
print(“Hello?static?library!”);//这里用到的是静态库中的函数??
return?0;??
}??
?3. 编写lib/Makefile.am 文件
[c-sharp]?view plaincopy
noinst_LIB
原创力文档

文档评论(0)