functions.h
#include<stdio.h>
void print_hello(void);
int factorial(int n);
main.c
#include<stdio.h>
#include<functions.h>
int main()
{
print_hello();
printf("\nThe factorial is: %d \n",factorial(5));
return 0;
}
hello.c
#include<stdio.h>
#include<functions.h>
void print_hello()
{
printf("\nHello World!\n");
}
factorial.c
#include<stdio.h>
#include<functions.h>
int factorial(int n)
{
if(n!=1)
{
return(n*factorial(n-1));
}
else
return 1;
}
Makefile
exec : \
compile
echo "Executing the object file"
./compile
compile : main.o hello.o factorial.o
echo "Compiling"
gcc -o compile $^
main.o : main.c functions.h
gcc -c main.c -I./INCLUDE -I./SRC
hello.o : hello.c functions.h
gcc -c hello.c -I./INCLUDE -I./SRC
factorial.o : factorial.c functions.h
gcc -c factorial.c -I./INCLUDE -I./SRC
Папка: make_example \ INCLUDE \ functions.h Папка:
make_example \ SRC \ main.c Папка: make_example \ SRC \ hello.c Папка:
make_example \ SRC \ factorial.c Папка: make_example \ makefile
Я получаю сообщение об ошибке при компиляции файла make как "desktop: ~ / make_example $ make
make: * Нет правила для создания цели main.c', needed by
main.o '. Стоп ".
Пожалуйста, помогите мне понять, почему эта ошибка