I am trying to compile a test through a make file. Why does the first path with ~/ not compile, while the second with the full path work. ARen't they the equivalent? Should I avoid using ~/ in makefiles?
This did not compile:
g++ -isystem ~/workspace/gtest-1.7.0/include -I~/workspace/gtest-1.7.0 -g -Wall -Wextra -pthread -c \ ~/workspace/gtest-1.7.0/src/gtest-all.cc /home/olivier/workspace/gtest-1.7.0/src/gtest-all.cc:42:24: fatal
error: src/gtest.cc: No such file or directory #include "src/gtest.cc"
This compiled fine:
g++ -isystem /home/olivier/workspace/gtest-1.7.0/include -I/home/olivier/workspace/gtest-1.7.0 -g -Wall -Wextra -pthread -c \ /home/olivier/workspace/gtest-1.7.0/src/gtest-all.cc
~
expansion doesn't generally work in the middle of a string. The shell that Make is using doesn't know what to do with -I~/whatever
. Try relative paths instead, or if you absolutely need an equivalent of ~
, try $(HOME)
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments