Solved

Link errors

Posted on 1997-05-06
1
212 Views
Last Modified: 2013-11-20
We're frequently running into these linkage errors and haven't been able to track the problem down.  If anyone else has run into this and solved it, we'd sure like to know.  A couple of us here have already checked the obvious....all our libraries are compiled multi-threaded.  The project links fine under RELEASE, but fails under DEBUG.

Linking...
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)"(??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)"(??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "nafxcw.lib" conflicts with use of other libs; use /NODEFAULTLIB:library

Sometimes, we're able to delete the project files and rebuild them from scratch and that will fix it.  We've done compares on the .MAK files and haven't seen anything significantly different.

Debug Compiler Flags: /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "OS_NO_MIN_MAX" /D "OS_NO_AUTO_INSTANTIATE" /D "HAS_WIN32_THREADS" /Fo"Debug/" /Fd"Debug/" /c

Debug Link Flags: ot42d.lib esql.lib eldorado.lib skycon.lib ospace.lib caw32.lib sqlakw32.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/AdInsert.pdb" /debug /machine:I386 /out:"Debug/AdInsert.exe"


Release Compiler Flags: /nologo /MT /W3 /GX /O2 /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "OS_NO_MIN_MAX" /D "OS_NO_AUTO_INSTANTIATE" /D "HAS_WIN32_THREADS" /Fo"Release/" /c

Release Link Flags: ot42r.lib esql.lib eldorado.lib skycon.lib ospace.lib caw32.lib sqlakw32.lib /nologo /subsystem:windows /incremental:no /pdb:"Release/AdInsert.pdb" /machine:I386 /out:"Release/AdInsert.exe"

0
Comment
Question by:Theurgist
1 Comment
 
LVL 2

Accepted Solution

by:
sapek earned 50 total points
ID: 1301371
I think this is a problem with the order default libraries are linked. I had similar problem with other libraries. I don't know what is the reason but you can try a workaround that worked for me. Put LIBCMTD.lib (or nafxcwd.lib, I can't recall which one it was) in *both* 'Ingnore Default Libraries' (or whatever it is exactly called) and 'Use libraries' edit boxes in Link section(General subset I believe) of project settings. I'm sorry that I can't be more specific but I don't have DevStudio here.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Separate files macro - Errors on larger data set 18 69
Replacement selected text 2 61
Not needed 13 112
Problem to App source 6 39
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question