I have a project that has three files. The main file is called login.c.
I want to #include my other two files using make, but I’m having trouble doing so.
Thanks in advance for any advice!!
here is my makefile:
objects = login.o cipher.o linked.o
coptions = -Wall -g -ggdb
loginTest: ${objects}
gcc ${coptions} -o loginTest ${objects}
login.o: login.c cipher.h linked.h
gcc -c ${coptions} login.c
cipher.o: cipher.c cipher.h
gcc -c ${coptions} cipher.c
linked.o: linked.c linked.h
gcc -c ${coptions} linked.c
the error I get:
make: *** No rule to make target `cipher.h', needed by `login.o'. Stop.
the files in my current working directory:
cipher.c
linked.c
linked.o
login.c
makefile
make can not automatically create *.h.
You need to create it and #include that *.h file by yourself.