I implement a link list in two files in linklist.h and linklist.c, and I call some functions defined in linklist.h in main function of main.c. linklist.h is included in both linklist.c and main.c. When I compile this program by GCC with Makefile, the error named "undefined reference to xxx" occurs. I think my Makefile is written correctly as below. So what is the possible reason for this linking error
CC=gcc
CFLAGS= -g -O2
TARGET=target
OBJECTS=main.o linklist.o
TARGET: $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o $(TARGET)
clean:
rm target $(OBJECTS)
main.o:linklist.h
linklist.o:linklist.h