#ifndef _HEAD_H_
#define _HEAD_H_
void test1();
void test2();
void test3();
#endif
#include<stdio.h>
void test1()
{
printf("test1\n");
}
#include<stdio.h>
void test1()
{
printf("test2\n");
}
#include<stdio.h>
void test1()
{
printf("test3\n");
}
#include <stdio.h>
#include "head.h"
void main()
{
test1();
test2();
test3();
}
编译步骤:
gcc -fPIC -shared *.c -o libtest.so
连接动态库:
gcc main.c -L. -ltest -o main
执行:
./main