mercredi 24 août 2016

g++ cannot find shared library

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?

Aucun commentaire:

Enregistrer un commentaire