test.c
#include <stdio.h>
void print()
{
printf("------------------------\n");
}
gcc -c test.c
gcc -shared -o libtest.so test.o
生成了libtest.so库
然后我调用它
main.c
extern void print();
int main()
{
print();
return 0;
}
gcc -L./ -ltest -o main main.c
./main
error while loading shared libraries: libtest.so: cannot open shared object file: No such file or directory
请高手指点一下 不知道哪儿错了