The following Makefile is not working and I am not sure what\'s going on.
CC = gcc CFLAGS = -Wall -g demo: ${CC} ${CFLAGS} demo.c -o demo lib: ${CC}
lib needs to be compiled as a library, not a program.
lib
Try changing it to:
main: ${CC} ${CFLAGS} main.c lib.o -o main lib: ${CC} ${CFLAGS} lib.c -c -o lib.o