LD_LIBRARY_PATH
is searched when the program starts, LIBRARY_PATH
is searched at link time.
caveat from comments:
ld
(instead of gcc
or g++
), the LIBRARY_PATH
or LD_LIBRARY_PATH
environment variables are not read.gcc
or g++
, the LIBRARY_PATH
environment variable is read (see documentation "gcc
uses these directories when searching for ordinary libraries").