EmbLogic's Blog

makefile

myapp: main.o 21.o 22.o
gcc -o myapp main.o 21.o 22.o
main.o: main.c a.h
gcc -c main.c
21.o: 21.c a.h b.h
gcc -c 21.c
22.o: 22.c b.h c.h
gcc -c 22.c
makefile:1: *** recipe commences before first target. Stop.

………how to resolve this?

2 Responses to makefile

  1. hemant.kumar says:

    i have done this but not showing any error
    check your program again and have you included
    “a.h” in main.c
    “a.h”,”b.h” in two.c
    “b.h”,”c.h” in three.c
    and use tab where it is neccessary .
    then make and finally
    ./myapp ,it will be executed

    Each command must begin with a tab character. This (obscure) syntax tells make that
    the characters that follow the tab are to be passed to a subshell for execution. If you
    accidentally insert a tab as the first character of a noncommand line, make will inter-
    pret the following text as a command under most circumstances. If you’re lucky and
    your errant tab character is recognized as a syntax error you will receive the message:
    $ make
    Makefile:6: *** commands commence before first target.
    Stop.

  2. hemant.kumar says:

    myapp: main.o 21.o 22.o
    no tab or any space otherwise you will get the same error always
    gcc -o myapp main.o 21.o 22.o
    (here use tab otherwise you will get an error *** missing separator. Stop.)
    you have to be very careful while you write ..

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>