Error while loading shared libraries created by myself.

  • I create a shared library and successfully build in QT GUI. I want to run the excutable file in the terminal, but I get the error:

    error while loading shared libraries: cannot open shared object file: No such file or directory

    I can run normally in the QT GUI, but can not run in the terminal, and get the above error. So what should be the reason for that? Something is wrong when I create the lib?
    My operation system is :ubuntu 14.04

  • Qt Champions 2017

    everything is ok i think
    It just cannot find
    so is this your lib ?
    and if you do "locate"
    where is it then ?

    Also try ldd on your exe and see

    Its important to understand that your exe NEEDS the Qt so files
    to run
    Look in linux section.
    "Linux GCC 32-bit and 64-bit compilers:"

  • @mrjj thanks for your reply, I just find the method, I need to set the environment variable, LD_LIBRARY_PATH. After setting that, I can run it on terminal. Thanks anyway!

  • Qt Champions 2017

    Ok. super. Well you need such folder if u plan to give programs to others.
    And yes LD_LIBRARY_PATH and rpath is how one can do it.

Log in to reply

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