Reputation: 3582
I'm using Qt Creator to build a GUI application, which depends on some extra libs. It works quite well when I run the application from Qt Creator. But while I try to start the application by double-clicking or from console, I found it failed to find those libs.
In my .pro
file, I configured the lib directory as follows:
MYDLLDIR = $$OUT_PWD/libs
INCLUDEPATH += $$MYDLLDIR
win32:LIBS += $$quote($$MYDLL/test.dll)
unix:LIBS += $$quote(-L$$MYDLLDIR) -ltest
My test.so
and test.so.1
and all others are under libs directory in my output folder. How can I make it to find those libs also during runtime?
Thank you.
Extra Note: I'm running under Ubuntu 16.04.
Upvotes: 0
Views: 2379
Reputation: 415
There are many possible solutions.
You can install your shared library to standard locations like /usr/lib
, /lib
or /usr/lib64
etc.
Or before running your application from console,
you can set the LD_LIBRARY_PATH
environment variable to include
the directory which contains your shared library.
See this link for details.
Upvotes: 2