#include <stdio.h>
void test()
{
printf("this is a test\n");
}
//编译静态库
gcc -c test.c
ar -r libtest.a test.o
#include <stdio.h>
void main()
{
printf("start:\n");
test();
}
//编译执行文件
gcc main.c -L. libtest.a -o main
./main