Please.Error in makefile.

Discussion in 'Mac Programming' started by trinhchiendt3, Nov 11, 2011.

  1. trinhchiendt3 macrumors newbie

    Joined:
    Nov 11, 2011
    #1
    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.
     
  2. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #2
    There are at least 2 typos in the makefile you posted.

    Please copy and paste the actual makefile between [CODE] and [/CODE] tags.
     
  3. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #3
    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
    
     
  4. trinhchiendt3 thread starter macrumors newbie

    Joined:
    Nov 11, 2011
    #4
    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!
     

Share This Page