0

Since I am using IDE instead of GNU writing codes, I am having a hard time reading those documents about Makefile, so far I couldn't find any documents states clearly where to put $BOOST_HOME. (I am using Boost Library for my project so it needs to compile with it)

so far I am compiling the program with this command:

g++ -Wall -std=c++11 -o ladder Source1.cpp -I/home/s/suw/boost_1_65_1

since this will be compile in other's computer so the path of boost library will be different thus I need to put $BOOST_HOME into Makefile, any help would be appreciated.

EDIT: So I think I need to set $BOOST_HOME a path and put it into makefile, but path is varies by different user, how to let somebody run my program by just using a simple:

g++ *.cpp -o foo 

???

Travis Su
  • 670
  • 2
  • 7
  • 17
  • 1
    possible duplicate: https://stackoverflow.com/questions/28890634/how-to-get-a-shell-environment-variable-in-a-makefile – dmedine Dec 01 '17 at 08:28
  • @dmedine That's not even answered my question, I know I can set `CPLUS_INCLUDE_FILE` and custom `BOOST_HOME` variable and export it but the problem is I don't know how to include what's before the boost directory, not other users have the same `/home/s/suw` path. – Travis Su Dec 01 '17 at 15:33
  • So the user has an environmental variable `BOOST_HOME` which is a relative path to the Boost directory(relative to his home directory), and you want Make to use the absolute path, is that correct? – Beta Dec 02 '17 at 01:35
  • @Beta yes yes Yes! – Travis Su Dec 02 '17 at 03:15
  • If you're on linux, you could probably just use `-I $(HOME)/$(BOOST_HOME)` – lockcmpxchg8b Dec 02 '17 at 05:17
  • relative paths are the (sadly necessary) devil – dmedine Dec 02 '17 at 17:38
  • I think @lockcmpxchg8b is correct, apart from things like leading tildes in `BOOST_HOME`. – Beta Dec 03 '17 at 01:48

0 Answers0