Click to See Complete Forum and Search --> : Porting to .NET from VC6


Dave C
August 15th, 2003, 10:51 AM
I'm trying to import an application from VC6 to .NET and I can't get it to link in debug configuration. It builds and runs OK in release mode.

The error I get is this:

HIDCPS error LNK2005: "void __cdecl operator delete(void *,int,char const *,int)" (??3@YAXPAXHPBDH@Z) already defined in nafxcwd.lib(afxmem.obj)

I've seen the KB article that talks about this, but it hasn't led me anywhere. It says the error happens if the CRT libraries link before the MFC libs. Each .cpp in my project has #include "StdAfx.h" as the first line, and that's supposed to make this happen.

This is my first C++.NET experience and I have no idea how to interpret the .NET project settings. For the life of me, I can't see any differences between Release and Debug configurations that would explain this. Can anyone please help?

Wrongway
August 21st, 2003, 11:44 AM
Dave,

On thing you can try is to create a project like the one you are porting from v6.0 and see what the link options are, apply the same options in your .net and see if it works. That is the only thing that I can think of...

Good Luck!

Larry

dude_1967
August 28th, 2003, 04:25 PM
Dave C,

I'm .NO Guru with the .NET, but I encountered similar problems when porting from VC6 to .NET. The problems arise when libraries of object files from VC6 remain in the project and are linked with code objects compiled from .NET.

I think there is a mixture of objects in the project. You must recompile all libraries and make sure that you recompile each and every source file. Delete the directories .\Release and .\Debug and check if you are importing any libraries which then need to be recompiled.

Good luck.

Sincerely, Chris.

:)