PDA

View Full Version : How to use a shared library - beginner



tomkonikkara
2nd March 2011, 08:17
I downloaded QLed plugin from the follwing link:
http://qt-apps.org/content/show.php/QLed+?content=72482
Then I compiled it successfully. Then got the file libqledplugin.so (I'm using ubuntu 10.04) in the build directory.
I just copied that file into my test project folder and compiled but getting the following error:
libqledplugin: no such file or directory
The test project was the same example downloaded along with the stuff in the above link. In .pro file the following code:
LIBS += libqledplugin
is already added in the example file. I don't know how to compile it successfully. Please help, I am a beginner.

aamer4yu
2nd March 2011, 08:58
You just need to give the name of library

LIBS += -lqledplugin

also if you want to give path,
LIBS += L<lib path> -l<libname>

tomkonikkara
2nd March 2011, 13:08
I already added,
LIBS += qledplugin
I am getting another error when adding
LIBS += -qledplugin

I copied the .so file into the current project directory. Is there any need to give the path explicitly? If I add path as you said, I am getting the same error.

Added after 1 16 minutes:

Hi there,
I got worked the program for the first time. But it works only when
1)adds LIBS+= libqledplugin.so into the .pro file
2)the same file is copied into qt/lib directory

How to include the path in to the working directory? I used INCLUDEPATH but no use. I insist present directory because of the easiness while sharing the program to other computers.