This is a possible dup of makefile error: undefined reference to main or Undefined reference in main Makefile or a few others. Both crc64 and getWord are supporting files for mainProg, which contains my main function. When I try to run my make file I am getting the compilation error below regarding my rules for crc64.o. In the c file I have the include statements and header files laid out in this post Creating your own header file in C so I should not be having linking errors related to linking header to the body.
ERROR:
gcc -g -Wall -std=c99 crc64.o -o crc64
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function ``_start':
(.text+0x20): undefined reference to ``main'
collect2: error: ld returned 1 exit status
Makefile
CC=gcc
COPTS=-g -Wall -std=c99
ALL=crc64 getWord mainProg
all: $(ALL)
crc64: crc64.o
$(CC) $(COPTS) $^ -o $@
getWord: getWord.o
$(CC) $(COPTS) $^ -o $@
mainProg: getWord.o crc64.o mainProg.o
$(CC) $(COPTS) $^ -o $@
crc64.o: crc64.c crc64.h
getWord.o: getWord.c getWord.h
mainProg.o: mainProg.c getWord.h crc64.h
.c.o:
$(CC) -c $(COPTS) $<