1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

simple makefile

Discussion in 'C' started by answerme, Apr 15, 2008.

  1. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    I have 2 dir one is src & include
    src contains len.c string.c
    include contains len.h
    my makefile contains
    Code:
    vpath %.c src
    CPPFLAGS =-I include
    
    string : string.o len.o
    	gcc $^ -o $@
    string.o: string.c include/len.h
    	gcc -c $<
    len.o:len.c include/len.h
    	gcc -c $<
    
    After giving command make iam getting error

    Code:
    [root@localhost sting]# make
    gcc -c src/string.c
    src/string.c:2:16: error: len.h: No such file or directory
    make: *** [string.o] Error 1
    
    WHere iam getting wrong
     

Share This Page