Not finding the library files directed to in Makefile

▼魔方 西西 提交于 2019-12-01 03:37:39

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!