Linking with Static Libraries (linux)

Discussion in 'C++' started by Herr Fieldmarshall, Jan 28, 2005.

  1. Hello,

    I've 2 static libraries (let's say libx.a and liby.a) and an executable
    (let's call it exe). exe only makes calls to liby.a but liby.a makes calls
    implemented in libx.a

    In my Makefile.am files for liby.a I added liby_a_LIBADD = $(path_to_libx.a)
    and in the Makefile.am I added a exe_LDADD = $(path_to_libx_a)
    $(path_to_liby_a)

    Nevertheless I still get Link-errors for the functions called in libx from
    liby...
     
    Herr Fieldmarshall, Jan 28, 2005
    #1
    1. Advertising

  2. Herr Fieldmarshall

    Lionel B Guest

    "Herr Fieldmarshall" <> wrote in message
    news:ctd5na$jau$...
    > Hello,
    >
    > I've 2 static libraries (let's say libx.a and liby.a) and an executable
    > (let's call it exe). exe only makes calls to liby.a but liby.a makes calls
    > implemented in libx.a
    >
    > In my Makefile.am files for liby.a I added liby_a_LIBADD =

    $(path_to_libx.a)
    > and in the Makefile.am I added a exe_LDADD = $(path_to_libx_a)
    > $(path_to_liby_a)
    >
    > Nevertheless I still get Link-errors for the functions called in libx from
    > liby...


    And this has what exactly to do with the C++ language?

    Try asking in a ng for your compiler.
     
    Lionel B, Jan 28, 2005
    #2
    1. Advertising

  3. Euhm, compilation issues...


    "Lionel B" <> wrote in message
    news:...
    > "Herr Fieldmarshall" <> wrote in message
    > news:ctd5na$jau$...
    >> Hello,
    >>
    >> I've 2 static libraries (let's say libx.a and liby.a) and an executable
    >> (let's call it exe). exe only makes calls to liby.a but liby.a makes
    >> calls
    >> implemented in libx.a
    >>
    >> In my Makefile.am files for liby.a I added liby_a_LIBADD =

    > $(path_to_libx.a)
    >> and in the Makefile.am I added a exe_LDADD = $(path_to_libx_a)
    >> $(path_to_liby_a)
    >>
    >> Nevertheless I still get Link-errors for the functions called in libx
    >> from
    >> liby...

    >
    > And this has what exactly to do with the C++ language?
    >
    > Try asking in a ng for your compiler.
    >
    >
     
    Herr Fieldmarshall, Jan 28, 2005
    #3
  4. Herr Fieldmarshall

    grymse Guest

    Turn the lib order around.
    exe_LDADD = $(path_to_liby_a) $(path_to_libx_a)
     
    grymse, Jan 28, 2005
    #4
  5. Herr Fieldmarshall

    Lionel B Guest

    (top-post re-arranged)

    "Herr Fieldmarshall" <> wrote in message
    news:ctd70j$jq5$...
    > "Lionel B" <> wrote in message
    > news:...
    > > "Herr Fieldmarshall" <> wrote in message
    > > news:ctd5na$jau$...
    > >> Hello,
    > >>
    > >> I've 2 static libraries (let's say libx.a and liby.a) and an executable
    > >> (let's call it exe). exe only makes calls to liby.a but liby.a makes
    > >> calls
    > >> implemented in libx.a
    > >>
    > >> In my Makefile.am files for liby.a I added liby_a_LIBADD =

    > > $(path_to_libx.a)
    > >> and in the Makefile.am I added a exe_LDADD = $(path_to_libx_a)
    > >> $(path_to_liby_a)
    > >>
    > >> Nevertheless I still get Link-errors for the functions called in libx
    > >> from
    > >> liby...

    > >
    > > And this has what exactly to do with the C++ language?
    > >
    > > Try asking in a ng for your compiler.

    >
    > Euhm, compilation issues...


    .... are off-topic here. See the FAQ for this ng, specifically:
    http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.9 The key
    phrase is: "Only post to comp.lang.c++ if your question is about the C++
    language itself". Your question has nothing to do with the C++ *language*
    and everything to do with (compiler/platform-specific) compilation/linkage
    issues.
     
    Lionel B, Jan 28, 2005
    #5
    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. Replies:
    4
    Views:
    40,705
    ucapajr
    May 3, 2008
  2. Brano

    question about linux static libraries

    Brano, Mar 15, 2006, in forum: C Programming
    Replies:
    2
    Views:
    346
    Igmar Palsenberg
    Mar 20, 2006
  3. barcaroller
    Replies:
    1
    Views:
    331
    Ian Collins
    Jun 12, 2007
  4. Replies:
    6
    Views:
    1,390
    James Kanze
    Jan 27, 2008
  5. Replies:
    1
    Views:
    175
    Terry Reedy
    Mar 8, 2013
Loading...

Share This Page