I have multiple versions of a library, all with the same name (boost libraries), each installed in its own directory. I know how to instruct the compiler and linker to search in certain directories for header files and libraries (-I
and -L
). I am also aware of how to pass the actual library file to the linker.
My question is how to specify precedence in the search path of the compiler and the linker, such that it searches folder A
before searching folder B
and takes A
's version of the library instead of B
's . I'm interested in order between all eligible directories, i.e. the default gcc
and g++
ones, and the ones specified after -I
and -L
.
My distro is Ubuntu 14.04
, and I use g++
4.8
up to 6
.