Search code examples
qtlibrariesqmake

understanding external library path qmake


I'm working with Qt and currently I have a problem understanding something about adding external libraries.

What I have now in my .pro file is this:

unix:!macx: LIBS += -L"/home/[RIGHT PATH]" -lOMD

where [RIGHT PATH] is the path to where the library is

if, however I put:

unix:!macx: LIBS += -L"/home/[WRONG PATH, TRASH]" -lOMD

it still works!

if I put:

unix:!macx: LIBS += -L"/home/[RIGHT PATH]"

it doesn't work anymore (compiling errors because it doesn't know some functions that are in the library).

Can someone please explain to me why?

Also, I put these .so files in usr/lib so I shouldn't even have to include them here, right?

Thank you!


Solution

    • The statement -L"PATH" means add PATH the library search directory list.
    • The statement -lOMD means load library OMD during linking.

    It seems somehow your library is already in the library search path. Which means LIBS += -lOMD will also work. Aside from some runtime libraries you have to specify the libraries to load.

    edit:
    /usr/lib is a default library search path. If you manually copy the library there, it will be found.