AlexRamallo
July 30th, 2011, 06:19 PM
I compiled a simple shared library for my program using g++. Its named "libFunctionLib.so" and it is in the same directory as the program.
I compiled the program(the one that uses it) using this command:
g++ main.cpp -o out -L. -lFunctionsLib
and that produced the program 'out' in the same directory as the libFunctionLib.so file. The problem is that when I try to run 'out' with the command
./out
I get this error:
./out: error while loading shared libraries: libFunctionsLib.so: cannot open shared object file: No such file or directory
(and that file definitely exists and it is in the same directory as the binary)
It seems like its only searching in the /usr/lib directory and not the local working directory. Is there a way get around this so that it searches for libraries in the working directory as well rather than just the systems /usr/lib directory?
I compiled the program(the one that uses it) using this command:
g++ main.cpp -o out -L. -lFunctionsLib
and that produced the program 'out' in the same directory as the libFunctionLib.so file. The problem is that when I try to run 'out' with the command
./out
I get this error:
./out: error while loading shared libraries: libFunctionsLib.so: cannot open shared object file: No such file or directory
(and that file definitely exists and it is in the same directory as the binary)
It seems like its only searching in the /usr/lib directory and not the local working directory. Is there a way get around this so that it searches for libraries in the working directory as well rather than just the systems /usr/lib directory?