views:

84

answers:

2

Hello friends,I am having a very diifult situation here...Actually I am developing a MFC project.In my project I have another small project inlcuded as a lib input to my main project.. I set the "use of MFC"--as "use MFC in Shared Dll" in my project settings...its working great..but when I set the "use of MFC" -- as "use MFC in static dll"..am not able to built the project both in debug/release mode.The reason that I dont want to set the "use MFC as Shared Dll" is because I want my project to run in machine which do not support visual studio...I am getting the following error:

error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in Client7z.lib(NewHandler.obj) uafxcwd.lib SelfExtractor

I read an article http://support.microsoft.com/kb/148652[^]..as per their suggestion i tried to ignore the follwing library Nafxcwd.lib;Libcmtd.lib but still its not working...if u guys knw any solution please help me.

A: 

You have to also change C runtime to static version. It's in C/C++ -> Code Generation -> Runtime Library.

Set it to /MT (Release) or /MTd (Debug).

Francis
I did that..But its still the same error...and the crazy thing is if i set my project in release mode its still /MT(Debug)..I also tried in all other modes..its not helping me
kiddo
You must have linked other libraries and that caused additional dependencies. Try to eliminate any "additional include" and "ignore libraries".Another method is to force the linking, just like Nick D's sample.
Francis
What I did was I inlcuded another library file as an input to my project (theres a need for it)...now what i did is i removed that library input and converted that into an dll and exported the required function from that module to my project... and its working gr8...there is no need to exclude Nafxcwd.lib Libcmtd.lib these lib's
kiddo
+1  A: 

Check out these settings on debug mode:

Link->General:
Object/Libary modules: Nafxcwd.lib Libcmtd.lib Client7z.lib

Link->Input:
Object/Libary modules: Nafxcwd.lib Libcmtd.lib Client7z.lib
Ignore libraries: libcmtd.lib,libcd.lib

A wild guess but at least you can try it.

Nick D