CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2008
    Posts
    18

    Multiply defined symbols?

    I have some static library libA.a that has symbols x & y defined. I'm building another static library libB.a which seems to also be defining symbols x & y. So when I try to build executable C while linking libA.a and libB.a, I get a multiply defined symbols error. But when I build libB.a linking libA.a, I don't get any errors. Shouldn't I get the same error when I try to build libB.a and link in libA.a?

    edit: I always find the problem after I make a post. My make file had an error in it and wasn't linking things properly.
    Last edited by homer_3; July 29th, 2009 at 10:43 AM.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Multiply defined symbols?

    Building a library doesn't have a concept of linking, at least not in the same way that executables do.

  3. #3
    Join Date
    Jan 2009
    Posts
    1,689

    Re: Multiply defined symbols?

    Those symbols need to be in the #include that you use to interface with the library, not the library itself.

  4. #4
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: Multiply defined symbols?

    Linker errors have nothing to do with #includes.

    Well, except that incorrect header file usage can cause them.

  5. #5
    Join Date
    Jan 2009
    Posts
    1,689

    Re: Multiply defined symbols?

    Oops, I misread the post.

  6. #6
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    Re: Multiply defined symbols?

    Try rename the symbol.
    Thanks for your help.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured