Results 1 to 7 of 7

Thread: set library include path

  1. #1
    Join Date
    May 2006
    Beans
    Hidden!

    set library include path

    Dear all,

    I have a problem. I have some library files in /home/ddd/mylibs/ . And I want to compile a program from another directory such that the compiler (g++) will automatically include my library files. But I don't know how to set the library include path in linux environment. Can anybody help me please

  2. #2
    Join Date
    Jun 2007
    Location
    Tacoma, WA
    Beans
    244
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: set library include path

    If you want the compiler to search a specific directory for libraries, use the '-L' option. For example, g++ -L/home/ddd/mylibs

    Now, if you use the lower-case L option, the compiler will search /home/ddd/mylibs for the library name. So if you have a lib 'libmylib.so' in /home/ddd/mylibs, you could now run 'g++ -L/home/ddd/mylibs -lmylib' and the linking should include libmylib.so.

    If you find that you are frequently using the -L option, check out the command ldconfig, or consider setting the environment variable 'LD_LIBRARY_PATH'.

    Does that help?

  3. #3
    Join Date
    May 2006
    Beans
    Hidden!

    Re: set library include path

    How to set the environment variable?
    Sorry, I am quite new on this matter

  4. #4
    Join Date
    Aug 2006
    Location
    Belgium
    Beans
    Hidden!
    Distro
    Xubuntu 8.04 Hardy Heron

    Re: set library include path

    You could also check man ldconfig so you could (temporary) add a directory to the library search path using:

    Code:
    sudo ldconfig /path/to/my/usr/local/lib/
    Use ldconfig -p to print out all libraries (and their location) in the library search path

  5. #5
    Join Date
    Jun 2006
    Location
    The Netherlands
    Beans
    2,185
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: set library include path

    Quote Originally Posted by wayanwolvie View Post
    How to set the environment variable?
    Sorry, I am quite new on this matter
    Code:
    export LD_LIBRARY_PATH=/home/ddd/mylibs

  6. #6
    Join Date
    Nov 2010
    Beans
    1

    Re: set library include path

    Quote Originally Posted by amo-ej1 View Post
    You could also check man ldconfig so you could (temporary) add a directory to the library search path using:

    Code:
    sudo ldconfig /path/to/my/usr/local/lib/
    Use ldconfig -p to print out all libraries (and their location) in the library search path
    thanks, this worked. however how to remove a directory in case we don't need it anymore ?

  7. #7
    Join Date
    Aug 2007
    Location
    Canada
    Beans
    3
    Distro
    Xubuntu 7.04 Feisty Fawn

    Re: set library include path

    Hi,

    I'm not sure if this is too late to respond or not. Or it may help the next person.

    I just downloaded the same program and ran into the same problem. However, I noticed libfmodex64.so was included in the install directory. I then found a script ts3client_runscript.sh that takes care of the library path for the user. I made my Custom Application Launcher point to that and had no problems.

    David

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •