生成动态库
假设已有文件 test.h test.c,我们将其生成为libtest.so
使用命令gcc -shared -fPIC test.h test.c -o libtest.so
假设已有文件 test.h test.c,我们将其生成为libtest.so
使用命令gcc -shared -fPIC test.h test.c -o libtest.so
生成静态库
假设已有文件 test.h test.c,我们将其生成为libtest.a
gcc -c test.c test.h
会生成test.o test.h.gh
ar rcs libtest.a test.o test.h.gh
会生成libtest.a
假设已有文件 test.h test.c,我们将其生成为libtest.a
gcc -c test.c test.h
会生成test.o test.h.gh
ar rcs libtest.a test.o test.h.gh
会生成libtest.a
使用方法:
参照我的另一篇文章即可http://blog.youkuaiyun.com/baidu_36649389/article/details/55258289