I have a main program purge.c in which functions from list.c are used. The listing is:
Code: Select all
#include <stdio.h>
#include "list.h"
#include <stdlib.h>
void purge_crs_lst( int_crs_lst *, space_crs * );
int main()
{
space_crs s;
initialize_space_crs_lst( &s );
int_crs_lst l = readlist_crs_lst( &s );
purge_crs_lst( &l, &s );
printlist_crs_lst( l, &s );
l = makenull_crs_lst( &l, &s );
return 0;
}
void purge_crs_lst( int_crs_lst *l_p, space_crs *s_p )
{
position_crs_lst p, q;
p = first_crs_lst( *l_p, s_p );
while( p != end_crs_lst( *l_p, s_p ) ) {
q = next_crs_lst( p, *l_p, s_p );
while( q != end_crs_lst( *l_p, s_p ) )
if( retrieve_crs_lst( p, *l_p, s_p ) == retrieve_crs_lst( q, *l_p, s_p ) )
delete_crs_lst( q, l_p, s_p );
else
q = next_crs_lst( q, *l_p, s_p );
p = next_crs_lst( p, *l_p, s_p );
}
}
When I compile this program with:
Code: Select all
gcc -Wall -o purge list.o purge.c
Code: Select all
/usr/bin/ld: /tmp/ccaSqwBa.o: in function `main':
purge_crs.c:(.text+0x25): undefined reference to `readlist_crs_lst'
/usr/bin/ld: purge_crs.c:(.text+0x44): undefined reference to `purge_crs_lst'
/usr/bin/ld: /tmp/ccaSqwBa.o: in function `purge_crs_lst':
purge_crs.c:(.text+0xa6): undefined reference to `first_crs_lst'
collect2: error: ld returned 1 exit status