views:

384

answers:

1

I have a atl com project that was compiling fine in VC6 which gives the following linker errors when compiled in VS2008.

error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in libcmt.lib(new.obj) File: uafxcw.lib

There are three more similar errors for delete, new[] and delete[].

I checked out several articles on the net and most of them say that its a conflict between CRT and MFC dlls. (Order in which they are picked up). One article suggests adding the conflicting lib to the ignore lib list in project settings.

Doing so, I am left with one error

error LNK2001: unresolved external symbol __afxForceEXCLUDE File:LMAN.Lib

The error points to a lib that is referenced by this project (a lib developed by us).

Any ideas on how to fix this? I am sure this would be a common problem for people doing migration to VS 2008.

A: 

Solved it.

It was not required to exclude uafxcw.lib. Just had to ensure that the MFC dlls were not used. Our lib LMAN.lib was using Afxdisp.h (an MFC dll) which was not required. I removed the include from that project and then voila! - build succeeded.

Bobby Alexander