how to ask gcc to link with older library ?

Discussion in 'C Programming' started by KC, Jun 26, 2005.

  1. KC

    KC Guest

    Hi,

    I have a library with both newer and older version
    installed, their soname are libHELLO.so.1 and libHELLO.so.2.

    When I use

    gcc prog.c -o prog -lHELLO

    the prog will use libHELLO.so.2 by default.
    A simple question, how can I ask gcc to use
    libHELLO.so.1 ?

    Thanks

    Regards
    KC
     
    KC, Jun 26, 2005
    #1
    1. Advertising

  2. In article <>,
    KC <> wrote:
    >I have a library with both newer and older version
    >installed, their soname are libHELLO.so.1 and libHELLO.so.2.


    Although the C standards talk about the standard library, the
    implementation details are intentially left exceedingly vague --
    to the point where the "library" could be an inherent part of
    the compiler, or of the OS, or in source code form, rather than a
    seperate file.

    The C standards do not specify anything (that I can recall) about the
    existance of other libraries -- only that there will be the ability to
    link together the compilation of seperate files. I haven't reviewed the
    wording for awhile, but my recollection is that a compiler that
    accepted only source files and insisted that all those source files
    be named on the (same) command line would be conforming -- i.e.,
    intermediate object code and libraries are not required to exist.


    >When I use
    >gcc prog.c -o prog -lHELLO
    >the prog will use libHELLO.so.2 by default.
    >A simple question, how can I ask gcc to use
    >libHELLO.so.1 ?


    As per the above discussion, that is a system and compiler dependant
    matter that you may need to ask about in one of the gnu.* newsgroups.

    In many implementations, you can link a specific version of a
    library by naming the fuller name of the containing file. For
    example,

    gcc prog.c -o prog -LHELLO.so.1

    or it might in your system be necessary to go as far as something like

    gcc -o prog prog.c /usr/local/lib/libHELLO.so.1

    If these don't work for you, ask in the gnu groups, specifying there
    your operating system.
    --
    'The short version of what Walter said is "You have asked a question
    which has no useful answer, please reconsider the nature of the
    problem you wish to solve".' -- Tony Mantler
     
    Walter Roberson, Jun 26, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    904
    Kevin Spencer
    May 17, 2005
  2. Replies:
    8
    Views:
    451
  3. RMZ
    Replies:
    0
    Views:
    266
  4. Paul Mcconnon

    Ruby MySQL Gem uses older client library

    Paul Mcconnon, Aug 2, 2006, in forum: Ruby
    Replies:
    1
    Views:
    114
    Paul Mcconnon
    Aug 3, 2006
  5. Jake Barnes
    Replies:
    1
    Views:
    86
    Thomas 'PointedEars' Lahn
    Feb 7, 2006
Loading...

Share This Page