multiple symbol defined

Discussion in 'C Programming' started by JackyMove, Aug 8, 2003.

  1. JackyMove

    JackyMove Guest

    Dear all,

    I have encount the following problem. I have compiled a library
    "lib.lib" successfully using a simulator compatable to VC++ on Windows
    platform. Then I try to build an executatble in another project with
    including "lib.lib". However, it gives me the errors: symbol xxx is
    defined multiple times in a.obj and b.obj in "lib.lib". It seems that
    there exists conflicts as I include some common ".h" file in both
    source codes of the executable and the library. I would like to ask if
    anyone know how to solve the problem.

    Thank you very much.

    Regards,
    Jacky
     
    JackyMove, Aug 8, 2003
    #1
    1. Advertising

  2. JackyMove

    Eric G. Guest

    JackyMove <> wrote:

    > Dear all,
    >
    > I have encount the following problem. I have compiled a library
    > "lib.lib" successfully using a simulator compatable to VC++ on Windows
    > platform. Then I try to build an executatble in another project with
    > including "lib.lib". However, it gives me the errors: symbol xxx is
    > defined multiple times in a.obj and b.obj in "lib.lib". It seems that
    > there exists conflicts as I include some common ".h" file in both
    > source codes of the executable and the library. I would like to ask if
    > anyone know how to solve the problem.


    Unfortunately, I do not. However, I could recomend that you try asking
    your question in a programming newsgroup related to your compiler or
    platform - you would be far more likely to find someone there familar
    with your specific setup then in here.

    --
    == Eric Gorr ========= http://www.ericgorr.net ========= ICQ:9293199 ===
    "Therefore the considerations of the intelligent always include both
    benefit and harm." - Sun Tzu
    == Insults, like violence, are the last refuge of the incompetent... ===
     
    Eric G., Aug 8, 2003
    #2
    1. Advertising

  3. In 'comp.lang.c', (JackyMove) wrote:

    > <...> I have compiled a library
    > "lib.lib" successfully using a simulator compatable to VC++ on Windows
    > platform.


    I trust you, but I'm curious. What kind of 'simulator' is able to compile a
    library?

    > Then I try to build an executatble in another project with
    > including "lib.lib".


    Ok.

    > However, it gives me the errors: symbol xxx is
    > defined multiple times in a.obj and b.obj in "lib.lib".


    Is it true? If yes, it means that your project is using source files that was
    are already used to build the library, or that you define public names
    already used by the library.

    > It seems that
    > there exists conflicts as I include some common ".h" file in both
    > source codes of the executable and the library. I would like to ask if
    > anyone know how to solve the problem.


    It's hard to say without a reduced-to-minimum example of your problem. Of
    course your design must follow the usual rules :

    - Public names are unique.
    - Public functions calls are prototyped.
    - The public prototypes are declared once and only once in a header.
    - This header is include both in the implementation files and in the user
    files.
    - This header is guarded again multiple inclusions:

    #ifndef H_XXX
    #define H_XXX
    /* xxx.h */
    <...>
    #endif /* guard */

    Just a reminder: headers only contain:

    - include of other headers
    - public macros definitions
    - public constant definitions
    - public types definitions
    - public functions prototypes
    - public objects declarations
    [C99]
    - public inline function definitions

    No object or function definition. Never.
    (well, except inline in C99).

    --
    -ed- [remove YOURBRA before answering me]
    The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    <blank line>
    FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
     
    Emmanuel Delahaye, Aug 8, 2003
    #3
  4. JackyMove

    bd Guest

    On Thu, 07 Aug 2003 20:08:39 -0700, JackyMove wrote:

    > Dear all,
    >
    > I have encount the following problem. I have compiled a library
    > "lib.lib" successfully using a simulator compatable to VC++ on Windows
    > platform. Then I try to build an executatble in another project with
    > including "lib.lib". However, it gives me the errors: symbol xxx is
    > defined multiple times in a.obj and b.obj in "lib.lib". It seems that
    > there exists conflicts as I include some common ".h" file in both
    > source codes of the executable and the library. I would like to ask if
    > anyone know how to solve the problem.


    Did you declare a variable without the extern keyword in one of those
    headers? If so, add the extern, and put the old declaration in one of the
    ..c files.
    --
    Freenet distribution not available
    But they went to MARS around 1953!!
     
    bd, Aug 8, 2003
    #4
  5. JackyMove

    JackyMove Guest

    Thanks for the help. In fact, I have carelessly included a ".c" file
    instead of ".h" and, so to raise such problem.

    Thank you.

    Regards,
    Jacky

    (JackyMove) wrote in message news:<>...
    > Dear all,
    >
    > I have encount the following problem. I have compiled a library
    > "lib.lib" successfully using a simulator compatable to VC++ on Windows
    > platform. Then I try to build an executatble in another project with
    > including "lib.lib". However, it gives me the errors: symbol xxx is
    > defined multiple times in a.obj and b.obj in "lib.lib". It seems that
    > there exists conflicts as I include some common ".h" file in both
    > source codes of the executable and the library. I would like to ask if
    > anyone know how to solve the problem.
    >
    > Thank you very much.
    >
    > Regards,
    > Jacky
     
    JackyMove, Aug 12, 2003
    #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. Michel Rosien
    Replies:
    3
    Views:
    3,985
    Rob Williscroft
    Sep 10, 2004
  2. baumann@pan
    Replies:
    1
    Views:
    757
    Richard Bos
    Apr 15, 2005
  3. Oodini
    Replies:
    1
    Views:
    1,795
    Keith Thompson
    Sep 27, 2005
  4. Song Ma
    Replies:
    2
    Views:
    244
    Charles Oliver Nutter
    Jul 20, 2008
  5. Replies:
    6
    Views:
    1,877
Loading...

Share This Page