CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Jun 2001
    Location
    Switzerland
    Posts
    4,443

    Unhappy Lnk1179

    Hello folks.

    I'm facing an annoying problem. I have a console app, pretty complicated, admitely. However, it compiles fine, but gives me a linking error:

    main.obj : fatal error LNK1179: invalid or corrupt file: duplicate comdat "?for_each@std@@YAP6AXPAD@ZViterator@?$list@PADV?$allocator@PAD@std@@@1@1P6AX0@Z@Z"


    The peculiar part is that I get the error in debug mode only. I am using std::for_each in one place only in my code, like this:
    Code:
    std::for_each(mem_.begin(), mem_.end(), kill);
    //where mem_ is
    std::list<char *> mem_;
    // ans kill() is
    static void kill(char *p){delete [] p;}
    I have searched MSDN without finding any info that was relevant for me. I compared the compiler/linker settings (VC++6.0SP5) one by one and the only differencies are the normal ones (that differentiate debug from release).

    Btw: I get the error regardles if I use the Dinkumware STL (that came with VC6) or STLPort (version 4-5-3)...

    Any thoughts, suggestions etc greatly appreciated.

    TIA,
    Gabriel, CodeGuru moderator

    Forever trusting who we are
    And nothing else matters
    - Metallica

    Learn about the advantages of std::vector.

  2. #2
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537
    There are a couple of links if you search for comdat in codeguru...or maybe you already did that...

    In this one, the OP had to re-install VC..

    http://www.codeguru.com/forum/showth...ghlight=comdat

  3. #3
    Join Date
    Jun 2001
    Location
    Switzerland
    Posts
    4,443
    I found a solution. Project->Settings->C++ tab, Debug cathegory: Inline function expansion: change from 'None' to 'Only _inline'.

    The credit goes to the author of this webpage
    Gabriel, CodeGuru moderator

    Forever trusting who we are
    And nothing else matters
    - Metallica

    Learn about the advantages of std::vector.

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