LNK2005-error in Visual C++ v. 6.0

J

Jon

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
 
V

Victor Bazarov

Jon said:
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.*".
 
J

Jussi Jumppanen

Jon said:
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
 
J

Jon

Jon said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top