Using library paths in makefiles

I wrote a make file like this:

HEADER = -I./cygdrive/c/cpros/kajj/source4
LIBB = -L./cygdrive/c/cpros/kajj/source1   -L./cygdrive/c/cpros/kajj/source2
LIBRA = -larith -ldekk

target : game.o 
    gcc $(HEADER)   $(LIBB)  $<  -o  $@  $(LIBRA)   

game.o : game.c 
    gcc -c  game.c

I created my own static library and included the path to the header file and the path to the library. When I execute my makefile, it gives an error saying that /usr/lib/gccit cannot find -larith -ldekk.

It points to the lib / directory, but it is not there: -ldekkand -larithare in the files source1 and source2 respectively.

How to solve this error?

+5
source share
1 answer

-L./cygdrive/cUse instead -L/cygdrive/c. The point makes the library path relative to the current directory, i.e. Will search for a subfolder of the cygdrivecurrent folder instead of drive C.

+7

All Articles