I've been working on this simple C project, trying to implement header, implementation, and makefiles. My professor provided the code for us to test, however whenever I use the "make hello3" command, the compiler gives me the error "undefined reference to `Print' " (Print is the name of the function trying to be implemented). Bellow are the files I've been working with.
Functions.h
#include <stdio.h>
void Print(char *str);
Functions.c
#include "Functions.h"
void Print(char *str)
{
printf("%s\n", str);
}
hello3.c
#include "Functions.h"
int main(int argc, char **argv)
{
char *myString="Hello, world!";
Print(myString);
return 0;
}
My Makefile
CC=gcc
OBJS=*.o
PROGS= hello3
INCS= -I.
hello3.o: hello3.c Functions.h
${CC} -c hello3.c
hello3: hello3.o Functions.o
${CC} hello3.o Functions.o -o hello3
Functions.o: Functions.c Functions.h
${CC} ${INCS} -c Functions.c
clean:
rm ${OBJS} ${PROGS}
Brandon D.
Ok I will check the tabs and yes there is a Functions.o file in my directory.09/08/19