I am trying to use make to compile and link two simple C programs in linux. Here is the two programs.
printf("This is a test\n");
I can compile and link these two using gcc without any trouble:
n = 10;
I want to compile and link the two using make but I don't think I am doing my Makefile correctly. Can someone explain how to do this? Here is what I have for my Makefile:
gcc -o combine combine1.c combine2.c
When I type $make
gcc -o project1 combine1.o
combine1.o: combine1.c combine2.c
gcc -c combine1.c
rm project1 combine1.o
I get the following:
Thanks for any help.
combine1.o: In function `main':
combine1.c:(.text+0x1b): undefined reference to `input'
collect2: ld returned 1 exit status
make: *** [project1] Error 1