Issue
I apologize that this is redundant, but none of the answers available seem to be able to solve my problem. I am attempting to compile an executable using a shared object library. The shared object library is called libsession.so
and is found in the same directory that I am compiling the executable. To compile and link, I use the following command
g++ test_main.cpp -o program -std=c++11 -I ../src/base -L. -lsession
Unforutanely, I get the cannot find -lsession error when linking. If I change the command to directly reference the shared library as follows
g++ test_main.cpp -o program -std=c++11 -I ../src/base libsession.so
then the executable compiles/links and all is well. Does anyone have any thoughts as to what I may be doing wrong?
Solution
The only difference between using an '-l' option and specifying a file name is that '-l' surrounds library with 'lib' and `.a' and searches several directories.
https://gcc.gnu.org/onlinedocs/gcc-3.0/gcc_3.html#SEC16
Answered By - Bob Answer Checked By - Cary Denson (WPSolving Admin)