During compilation with g++
via make
define LIBRARY_PATH
if it may not be appropriate to change the Makefile with the -L
option. I had put my extra library in /opt/lib
so I did:
$ export LIBRARY_PATH=/opt/lib/
and then ran make
for successful compilation and linking.
To run the program with a shared library define:
$ export LD_LIBRARY_PATH=/opt/lib/
before executing the program.