Find the answer to your Linux question:
Results 1 to 3 of 3
how i can use /usr/lib shared libraries in my program i.e. predefined function of that file....
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2011
    Posts
    4

    shared libraries


    how i can use /usr/lib shared libraries in my program i.e. predefined function of that file.

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,211
    Quote Originally Posted by abhikohokade View Post
    how i can use /usr/lib shared libraries in my program i.e. predefined function of that file.
    You need to put an include directive at the top of your program to load the headers for the library. So for libfoo:
    #include /usr/include/foo.h
    (I assume they'll be in /usr/include because that's the standard location)
    Then, when you build the program, you'll need the compilation flag -lfoo. I think libraries in /usr/lib are located automatically; if not you might also need L/usr/lib.
    "I'm just a little old lady; don't try to dazzle me with jargon!"
    www.hrussman.entadsl.com

  3. #3
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    1,211

    Red face

    Quote Originally Posted by hazel View Post
    #include /usr/include/foo.h
    Oops! Sorry That should have been:
    #include foo.h
    You don't put "/usr/include" because that's assumed. Just shows you shouldn't believe everything you read in the forums.
    "I'm just a little old lady; don't try to dazzle me with jargon!"
    www.hrussman.entadsl.com

Posting Permissions

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