So I'm trying to create my first ever Makefile and have run into some issues. My program is broken down like this:
filter.c - contains main()
includes.h - #defines
io/file_io.c - contains some functions that main() uses
io/file_io.h - included in filter.c and file_io.c
Hopefully that is clear enough. Now here is my make file:
# This makefile compiles and links the 3D filter program
#
# Generated by: Ryan Forbes
# Last Modified: 28-JAN09
# ******************************************************************************
# These parameters control the Makefile Operation
CC = gcc
CFLAGS = -g
CFLAGSPOST = -lm
IO = io/
# ******************************************************************************
# These entries bring the 3Dfilter executable up to date
3DFilter: filter.o $(IO)file_io.o
$(CC) $(CFLAGS) -o 3Dfilter filter.o $(IO)file_io.o
filter.o: filter.c $(IO)file_io.h includes.h
$(CC) $(CFLAGS) filter.c $(CFLAGSPOST)
file_io.o: $(IO)file_io.c $(IO)file_io.h includes.h
$(CC) $(CFLAGS) $(IO)file_io.c
However, when I try to run make, I get the following:
make
gcc -g filter.c -lm
/tmp/ccf326YC.o: In function `main':
/home/ctnetap1/de042465/3d_scic/music/src/cxx/filter.c:133: undefined reference to `getImageFiles'
/home/ctnetap1/de042465/3d_scic/music/src/cxx/filter.c:140: undefined reference to `getImageVolume'
/home/ctnetap1/de042465/3d_scic/music/src/cxx/filter.c:145: undefined reference to `getImageVolumeSwap'
collect2: ld returned 1 exit status
The functions its not finding are in the file_io files. Any ideas on what I am doing wrong? Thanks ahead of time.