Multiple definition of xxx

Discussion in 'C Programming' started by Rob Amboss, Dec 10, 2008.

  1. Rob Amboss

    Rob Amboss Guest

    Hi all

    I try to link against a library "linktest" which contains the function
    that I wanna link to. However, it seems that there is also the same
    function defined in the /usr/bin/ld if i understand the errormessage
    below correctly.

    ...//libtest.a(bn86-elf.o)(.text+0x860): In function `xxx':
    : multiple definition of `test_words'
    /tmp/cc1BVZOC.o(.text+0x0):test.c:83: first defined here
    /usr/bin/ld: Warning: size of symbol `xxx' changed from 863 in
    /tmp/cc1BVZOC.o to 1394 in ..//libtest.a(bn86-elf.o)
    collect2: ld returned 1 exit status

    Is there a way to tell the linker to take the function from the library
    and ignore the other one in the usr/bin/ld?

    Thanks!
     
    Rob Amboss, Dec 10, 2008
    #1
    1. Advertising

  2. On 2008-12-10, Rob Amboss <> wrote:
    >
    > I try to link against a library "linktest" which contains the function
    > that I wanna link to. However, it seems that there is also the same
    > function defined in the /usr/bin/ld if i understand the errormessage
    > below correctly.
    >
    > ..//libtest.a(bn86-elf.o)(.text+0x860): In function `xxx':
    >: multiple definition of `test_words'
    > /tmp/cc1BVZOC.o(.text+0x0):test.c:83: first defined here
    > /usr/bin/ld: Warning: size of symbol `xxx' changed from 863 in
    > /tmp/cc1BVZOC.o to 1394 in ..//libtest.a(bn86-elf.o)
    > collect2: ld returned 1 exit status


    The /usr/bin/ls in the errors above is ld identifying its output
    so that you know that particular error is coming from ld (the
    linker) rather than another phase of the build process. It is an
    error _from_ ld, not _about_ ld.

    Based on the other information you have supplied it appears that
    the problem is that linktest is indeed defined twice, but the extra
    definition is on or about line 83 of test.c. Take a look at it.
    Hint: make sure that it is a _declaration_ and not a _definition_.

    --
    Andrew Smallshaw
     
    Andrew Smallshaw, Dec 10, 2008
    #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. Åukasz Ligowski

    "xxx.has_key(a)" vs "a in xxx"

    Åukasz Ligowski, Oct 30, 2008, in forum: Python
    Replies:
    0
    Views:
    295
    Åukasz Ligowski
    Oct 30, 2008
  2. Replies:
    0
    Views:
    1,026
  3. Bert Leu

    value of type "xxx" cannot be converted to "xxx"

    Bert Leu, Jun 5, 2007, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    293
    Jesse Houwing
    Jun 6, 2007
  4. Richard Lionheart
    Replies:
    4
    Views:
    288
    Richard Lionheart
    May 5, 2004
  5. Iñaki Baz Castillo
    Replies:
    5
    Views:
    153
    Iñaki Baz Castillo
    Mar 30, 2008
Loading...

Share This Page