Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

trinhchiendt3

macrumors newbie
Original poster
Nov 11, 2011
2
0
I'm sorry if this is a stupid question, but I'm new in makefile.
I have two file hello.c and hello.h
When I implement in terminal of ubutu by command:
gcc -o hello hello.c
it is ok because hello.o is created.
However, when I write a makefile whose content:
CC=make
CFLAGS=-I
hell.o : hello.c
gcc-c hello.o
And then, I invoke makefile by command "make". Terminal informs:
"***missing separator. Error 127.
I don't know how to fix it. Please help me,thank for all.
 
There are at least 2 typos in the makefile you posted.

Please copy and paste the actual makefile between [CODE] and [/CODE] tags.
 
This should do it.

Code:
CC=gcc
CFLAGS=-I

hello: hello.o
	cc hello.o -o hello

hello.o: hello.c hello.h
	cc -c hello.c
 
This should do it.

Code:
CC=gcc
CFLAGS=-I

hello: hello.o
	cc hello.o -o hello

hello.o: hello.c hello.h
	cc -c hello.c

Thank you so much. I repare it to"
CC=gcc
CFLAGS=-I
hello.o: helloc hello.h
cc -c hello.c
my program runs nicely.
I want to ask a further question. Please tell me about ERROR 127. I regularly get it. Thank you!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.