Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > LNK2005-error in Visual C++ v. 6.0

Reply
Thread Tools

LNK2005-error in Visual C++ v. 6.0

 
 
Jon
Guest
Posts: n/a
 
      08-25-2004
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
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      08-25-2004
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.*".
 
Reply With Quote
 
 
 
 
Jussi Jumppanen
Guest
Posts: n/a
 
      08-25-2004
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
 
Reply With Quote
 
Jon
Guest
Posts: n/a
 
      08-25-2004
Victor Bazarov <> wrote in
news:RH0Xc.249$ io.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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OT]Visual Studio / Visual Source Safe 6.0 Rob Meade ASP .Net 2 05-22-2004 10:22 AM
visual studio .net 2003 verses visual studio .net 2002 wh ASP .Net 2 01-16-2004 04:54 PM
eMbedded Visual Basic & Visual Studio .NET - No Longer Supported? ¢harlie MCSD 0 12-26-2003 07:23 PM
Trivial question - Visual C# .Net vs Visual Studio .Net John Timbers ASP .Net 32 11-08-2003 06:12 AM
Upgrading Microsoft Visual Basic 6.0 to Microsoft Visual Basic .NET Jaime MCSD 2 09-20-2003 05:16 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57