How to make Win32 dll depend on mfc dll?
-
We have a situation where a non mfc dll must depend on mfc dll. When trying to compile, we got an error saying that Windows.h is already included. When the _WINDOWS_ definition was undeffed, the compile error was gone, however it shows bunch of link errors. Do you have any idea how to fix this? Thanks a lot!! NonMFCDll error LNK2001: unresolved external symbol ___argc NonMFCDll error LNK2001: unresolved external symbol ___argv NonMFCDll error LNK2001: unresolved external symbol __mbctype NonMFCDll error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in msvcprt.lib(newop_s.obj) NonMFCDll error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in MSVCRT.lib(MSVCR71.dll) NonMFCDll error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in MSVCRT.lib(MSVCR71.dll) NonMFCDll error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj) NonMFCDll error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall _AfxAbbreviateName(char *,int,int)" (?_AfxAbbreviateName@@YGXPADHH@Z) NonMFCDll fatal error LNK1120: 3 unresolved externals Kurnia
-
We have a situation where a non mfc dll must depend on mfc dll. When trying to compile, we got an error saying that Windows.h is already included. When the _WINDOWS_ definition was undeffed, the compile error was gone, however it shows bunch of link errors. Do you have any idea how to fix this? Thanks a lot!! NonMFCDll error LNK2001: unresolved external symbol ___argc NonMFCDll error LNK2001: unresolved external symbol ___argv NonMFCDll error LNK2001: unresolved external symbol __mbctype NonMFCDll error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in msvcprt.lib(newop_s.obj) NonMFCDll error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in MSVCRT.lib(MSVCR71.dll) NonMFCDll error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in MSVCRT.lib(MSVCR71.dll) NonMFCDll error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj) NonMFCDll error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall _AfxAbbreviateName(char *,int,int)" (?_AfxAbbreviateName@@YGXPADHH@Z) NonMFCDll fatal error LNK1120: 3 unresolved externals Kurnia
Have you tried adding mfc71.dll (in your release build) or mfc71d.dll (in your debug build) to the Ignore Specific Library (/NODEFAULTLIB) property?
-
Have you tried adding mfc71.dll (in your release build) or mfc71d.dll (in your debug build) to the Ignore Specific Library (/NODEFAULTLIB) property?
That should be mfc71.lib and mfc71d.lib, or mfc71u.lib and mfc71ud.lib in a wide character application.
-
We have a situation where a non mfc dll must depend on mfc dll. When trying to compile, we got an error saying that Windows.h is already included. When the _WINDOWS_ definition was undeffed, the compile error was gone, however it shows bunch of link errors. Do you have any idea how to fix this? Thanks a lot!! NonMFCDll error LNK2001: unresolved external symbol ___argc NonMFCDll error LNK2001: unresolved external symbol ___argv NonMFCDll error LNK2001: unresolved external symbol __mbctype NonMFCDll error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in msvcprt.lib(newop_s.obj) NonMFCDll error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in MSVCRT.lib(MSVCR71.dll) NonMFCDll error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in MSVCRT.lib(MSVCR71.dll) NonMFCDll error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj) NonMFCDll error LNK2019: unresolved external symbol __mbctype referenced in function "void __stdcall _AfxAbbreviateName(char *,int,int)" (?_AfxAbbreviateName@@YGXPADHH@Z) NonMFCDll fatal error LNK1120: 3 unresolved externals Kurnia
Actually the NonMFCDll uses preprocessor _USRDLL. Removal of this and adding of _AFXDLL solved the problem. Thank you all.