i have got main function n two other functions
main program : test.c
other two : test1.c and test2.c
1.here is the code for:- test.c
#include<stdio.h>
#include<string.h>
int string_length (char *);
char *string_concat (char *, char *);
int
main (void)
{
char *s, *t;
printf ("Enter two strings");
scanf ("%s%s", s, t);
printf ("\nthe length of %s:-%d\nthe length of %s:-\n", s, string_length(s), t, string_length(t));
printf ("the concated string is ..%s", string_concat(s, t));
return 0;
}
2. test1.c :-
int
strng_length (char *s)
{
return (strlen (s));
}
3.test2.c:-
char *
strng_concat (char *s, char *t)
{
return (strcat (s, t));
}
4.Makefile:-
libtest.a:
gcc -c test1.c test2.c
ar -cvq libtest.a test1.o test2.o
5.linkin error i think :-
gcc test.c libtest.a
/tmp/ccIzmcsD.o: In function `main':
test.c
.text+0x3f): undefined reference to `string_length'
test.c
.text+0x4c): undefined reference to `string_length'
test.c
.text+0x82): undefined reference to `string_concat'
collect2: ld returned 1 exit status
so solve my problem!!!
thankx