Thread: error on using shared library

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    569

    error on using shared library

    I have a code that uses a shared library, however when I tried to run it, it gives me this error:

    cannot open shared object file: No such file or directory

    how do I fix this? my instructor said something about using

    setenv LD_LIBRARY_PATH .....

    but what should I put in the ..... is it the directory where the .so file is?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Try
    echo $LD_LIBRARY_PATH
    to see what is setup already.

    It's a ; separated list, like the PATH variable itself.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Run "ldd <binaryname>" to get a dump of the libraries it's TRYING to find. It will show which one it cannot find -- now go find that library and add its location to LD_LIBRARY_PATH.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. shared library for QNX
    By ReeV in forum C Programming
    Replies: 3
    Last Post: 05-06-2009, 10:58 AM
  2. Shared library design problem
    By p1r0 in forum C++ Programming
    Replies: 9
    Last Post: 03-23-2009, 12:36 PM
  3. Problems using/creating a shared library
    By benshi in forum C++ Programming
    Replies: 2
    Last Post: 05-13-2008, 02:27 PM
  4. Global variable in shared library
    By krock923 in forum C Programming
    Replies: 5
    Last Post: 01-11-2008, 04:56 PM
  5. Problem calling external method from within a shared library
    By Major Tom in forum C++ Programming
    Replies: 0
    Last Post: 04-21-2007, 09:14 AM