LNK2005-error in Visual C++ v. 6.0

Discussion in 'C++' started by Jon, Aug 25, 2004.

  1. Jon

    Jon Guest

    Hi!
    I have a problem that have followed me for a long time.
    When linking, sometimes this link error below arises. My solution is
    always to remove all files in the project, throw away all debug-files
    (.obj), rebuild, insert all files in the project and rebuild. After that
    procedure, the linker usually proceed.
    But not this time. So I decided to try and find the real problem, but
    failed. So here I am.

    When Linking in debug-mode, this error below comes up. When linking in
    release-mode, everything works fine. So, according to helpfiles, this is
    some mix-up with debug and release libraries. Just that I can't figure it
    out by myself.

    I hope someone can help me solve this!

    The errormessage:
    --------------------Configuration: SH03 - Win32 Debug--------------------
    Linking...
    nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator
    new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCD.lib(new.obj)
    nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator
    delete(void *)" (??3@YAXPAX@Z) already defined in LIBCD.lib(dbgdel.obj)
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
    __endthreadex
    nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
    __beginthreadex
    Debug/SH03.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.

    SH03.exe - 5 error(s), 0 warning(s)

    Here are the libraries that I include in the project:
    dxguid.lib dsound.lib ddraw.lib dinput.lib winmm.lib comctl32.lib
    msacm32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
    advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
    odbccp32.lib


    Thank's for any help!
    Jon Lennryd
     
    Jon, Aug 25, 2004
    #1
    1. Advertising

  2. Jon wrote:
    > I have a problem that have followed me for a long time.
    > When linking, sometimes this link error below arises. My solution is
    > always to remove all files in the project, throw away all debug-files
    > (.obj), rebuild, insert all files in the project and rebuild. After that
    > procedure, the linker usually proceed.
    > But not this time. So I decided to try and find the real problem, but
    > failed. So here I am.
    > [...]


    Yes, here you are, in comp.lang.c++ where link errors are usually OT and
    where product-specific solutions are definitely OT. Perhaps you will see
    the light and find the right newsgroup. Hint: "microsoft.public.vc.*".
     
    Victor Bazarov, Aug 25, 2004
    #2
    1. Advertising

  3. Jon wrote:

    > I hope someone can help me solve this!
    >
    > The errormessage:
    > ------------Configuration: SH03 - Win32 Debug--------------------
    > Linking...
    > nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator
    > new(unsigned int)" (??2@YAPAXI@Z) already defined in
    > LIBCD.lib(new.obj)
    > nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator
    > delete(void *)" (??3@YAXPAX@Z) already defined in
    > LIBCD.lib(dbgdel.obj)


    These messages usually occur if you mix and match the different run
    time libraries. The MSVC++ offers single threaded, multi threaded,
    multi threaded dll version of the run time libraries in both debug
    and release and if you do not use the same RTL for all the libraries
    and objects that make up the executable or dll, you get this warning.

    > nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
    > __endthreadex
    > nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
    > __beginthreadex
    > Debug/SH03.exe : fatal error LNK1120: 2 unresolved externals


    In a similar mannaer, I think this warning message disapears if you
    make sure all files are compiled to use the multi threaded or multi
    threaded dll RTL.

    Jussi Jumppanen
    Author of: Zeus for Windows (New version 3.93 out now)
    "The C/C++, Cobol, Java, HTML, Python, PHP, Perl programmer's editor"
    Home Page: http://www.zeusedit.com
     
    Jussi Jumppanen, Aug 25, 2004
    #3
  4. Jon

    Jon Guest

    Victor Bazarov <> wrote in
    news:RH0Xc.249$09.us.to.verio.net:

    > Jon wrote:
    >> I have a problem that have followed me for a long time.
    >> [...]

    >
    > Yes, here you are, in comp.lang.c++ where link errors are usually OT
    > and where product-specific solutions are definitely OT. Perhaps you
    > will see the light and find the right newsgroup. Hint:
    > "microsoft.public.vc.*".


    Yep, you're right, it's quite product-specific, thank's for the hint.
     
    Jon, Aug 25, 2004
    #4
    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. ivan

    Visual Studio 2003 linker error LNK2005

    ivan, Jul 18, 2006, in forum: C Programming
    Replies:
    2
    Views:
    7,077
    pavan_2804
    Aug 4, 2006
  2. Angus Comber
    Replies:
    1
    Views:
    780
    Martin Ambuhl
    Jan 8, 2005
  3. Taran

    LNK2005 error

    Taran, Jun 15, 2006, in forum: C++
    Replies:
    0
    Views:
    478
    Taran
    Jun 15, 2006
  4. Taran

    LNK2005 error

    Taran, Jun 15, 2006, in forum: C++
    Replies:
    3
    Views:
    622
    Default User
    Jun 22, 2006
  5. Angus
    Replies:
    2
    Views:
    3,460
    Jim Langston
    Dec 28, 2006
Loading...

Share This Page