- 论坛徽章:
- 0
|
静态库源码(testa.c):
#include "pub.h"
#include <stdio.h>;
testa3(int *i, char *string)
{
memcpy(string, "ssssss", strlen(string));
*i = 99;
return 0;
}
调用静态库的源码(test.c):
#include "pub.h"
void main()
{
int i;
char str[40];
testa3(&i,str);
printf("str:%s\n",str);
return;
}
头文件 pub.h:
int testa3(int *i, char *string);
编译静态库:
cc -c testa.c
ar r libtesta.a testa.o
编译test.c
cc -L. -ltesta test.c
报错:
undefined first referenced
symbol in file
testa3 test.o
i386ld fatal: Symbol referencing errors. No output written to a.out
诸位大哥帮我看看怎么回事,谢谢//bow |
|