CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Posts
    23

    Linker errors confuses me

    Hi,

    I've been getting some linker errors, which has never happened before - and I guess I was wondering if anyone had any idea what these meant:

    The projects name is AsynchBeta1.1

    AsynchBeta1.1Dlg.obj : error LNK2005: "void __cdecl CallbackProc(long,long)" (?CallbackProc@@YAXJJ@Z) already defined in AsynchBeta1.1.obj

    C:\Documents and Settings\victorh\My Documents\Visual Studio 2005\Projects\AsynchBeta1.2\Debug\AsynchBeta1.1.exe : fatal error LNK1169: one or more multiply defined symbols found

    I'm not posting the code yet because well, the entirety of the code amounts to over 15 mb, and I was hoping that linker error could be explained simply, like I made a big boo boo, or I missed some typical convention which can be spotted just by looking at the error title, etc.

    Thanks to those who take a look at this~

  2. #2
    Join Date
    Jul 2001
    Location
    Otaki, New Zealand
    Posts
    303

    Re: Linker errors confuses me

    The linker is telling you that your function is defined twice in different object modules.

    It has already encountered a publicly visible function body for CallbackProc that takes two longs as parameters and returns a void in the Asynchbeta1.1.obj (from AsynchBeta1.1.cpp). It has then encountered another publicly visible version in the AsynchBeta1.1Dlg.obj (from AsynchBeta1.1Dlg.cpp).

    You need to remove the duplicate version, extern a declaration into a header file or change them to file scope by making them static. Without seeing the code I can't say which would be the best solution in your case.

    Regards
    Alan

  3. #3
    Join Date
    Jun 2007
    Posts
    23

    Re: Linker errors confuses me

    Awesome, it turned out that I did have the same header included in both files, with a function in that header. Thanks a bunch, I'll try to remember this for future reference! : )

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