From the date of your posting, I assume you've given up or found the answer yourself (I JUST joined). Anyway, here is the answer to the LNK2005 problem:
MFC, by design, links Libcmtd.lib before Nafxcwd.lib (debug mode). Thus, you can get the LNK2005. Other libraries can cause this, especially when you go to build the release version.
OK... How do you find out which libraries are causing the problem?
In the Project Options: edit box, ensure that the option
/verbose:lib
is present. Run a build and note the diagnostics; you'll pretty easily see the libraries causing the problem. For example:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\LIBCMTD.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\LIB\OLDNAMES.lib:
Searching C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB\nafxcwd.lib:
nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
See? NAFXCWD suffered the error but it was conflicting with LIBCMTD.
You can override link order as follows:
1- Project menu Settings item
Opens Project Settings dialog box
2- Select build goal in the Settings For: drop down list
3- Click the Link tab
4- Select Input in the Category: drop down
5- Apply names (any order) of the offending libraries in the Ignore libraries: edit box
LIBCMTD.LIB NAFXCWD.LIB
6- Do the same thing in the Object/library modules: edit box BUT ENSURE THAT THE ORDER IS PROPER
NAFXCWD.LIB LIBCMTD.LIB
7- Click OK and rebuild
Are you using Visual .NET? There is a slightly different method of setting properties, but the concepts are the same.