Unable to link .so file

  • I have .so files (myLib.so, myLib.so.1, myLib.so.1.0, myLib.so.1.1.0) which I copied to my executable's directory. In project settings I added

    @LIB += -lmyLib@

    and also set the LD_LIBRARY_PATH to point to where my .so files are located.

    I also tried

    @LIB += -L/home/me/ProjectFolder/-lmyLib@

    I always get this error:

    (.text.startup+0x39):-1: error: undefined reference to `MyLib::Test()'

    How can I use the .so file?

  • Maybe because your lib fails linux library naming convention?
    -l<libname> means what the linker should search for lib<libname>.{a.so} and link it.
    -lmyLib - will search for libmyLib.{a.so}, and if your library name is myLib.so it will fail...

    You can try to point to the library file directly:

    LIB += /home/me/ProjectFolder/myLib.so

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.