Not finding the library files directed to in Makefile

前端 未结 1 841
不知归路
不知归路 2021-01-11 19:17

I am trying to compile this tool. Below is the beginning of its Makefile:

CC      = gcc
CFLAGS  = -Wall -O2 -D TRACES
DFLAGS  = -g -Wall -o0
CPPFLAGS= $(INCL         


        
相关标签:
1条回答
  • 2021-01-11 19:44

    The problem is the use of the tilde to mean "Home directory". A shell will do tilde expansion only if the tilde is the first nonquoted character in a word. Makefiles never do tilde expansion. Thus, in

    gcc -L~/include ...
    

    the shell does not perform tilde expansion and gcc will look for a directory named "~/include" in the current directory. But in

    gcc -L ~/include ...
    

    the shell does perform tilde expansion and gcc sees

    gcc -L /usr/username/include ...
    

    instead, which works as expected. The right thing to do is to never use tilde expansion for the home directory, but simply use $HOME appropriately in the Makefile, e.g.

    INCLUDE_DIR     = $$HOME/include
    
    0 讨论(0)
提交回复
热议问题