?
Solved

Link errors

Posted on 1997-05-06
1
Medium Priority
?
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

719 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