N
nick
i have 5 files,when i use make command to compile them a error occurs
"make: Warning: Infinite loop: Target `c.o' depends on itself"
when i type make an warning message occurs
cc -c b.c
cc -c a.c
make: Warning: Infinite loop: Target `c.o' depends on itself
cc -c c.c
cc b.o a.o c.o -o a
1. file :c.c
#include <stdio.h>
void print(){
printf("%d",1);
}
2. file : c.h
#ifndef t
#define t
#include <stdio.h>
void print();
#endif
3. file : b.c
#include "c.h"
void print2(){
printf("%d",2);
}
4. file : b.h
void print2();
5. file : a.c
#include "b.h"
#include "c.h"
extern int h;
int main(){
print();
print2();
return 0;
}
the makefile
a: b.o a.o c.o b.h c.h
cc b.o a.o c.o -o a
b.o: b.c b.h
cc -c b.c
c.o: c.o c.h
cc -c c.c
thanks!
"make: Warning: Infinite loop: Target `c.o' depends on itself"
when i type make an warning message occurs
cc -c b.c
cc -c a.c
make: Warning: Infinite loop: Target `c.o' depends on itself
cc -c c.c
cc b.o a.o c.o -o a
1. file :c.c
#include <stdio.h>
void print(){
printf("%d",1);
}
2. file : c.h
#ifndef t
#define t
#include <stdio.h>
void print();
#endif
3. file : b.c
#include "c.h"
void print2(){
printf("%d",2);
}
4. file : b.h
void print2();
5. file : a.c
#include "b.h"
#include "c.h"
extern int h;
int main(){
print();
print2();
return 0;
}
the makefile
a: b.o a.o c.o b.h c.h
cc b.o a.o c.o -o a
b.o: b.c b.h
cc -c b.c
c.o: c.o c.h
cc -c c.c
thanks!