Solved

Link errors

Posted on 1997-05-06
1
203 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 85
cat dog challenge 18 122
Add content to output file 4 58
wordmultiple challenge 12 93
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now