Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Link errors

Posted on 1997-05-06
1
Medium Priority
?
228 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 100 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Integration Management Part 2
Suggested Courses
Course of the Month11 days, 4 hours left to enroll

885 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