Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to make Win32 dll depend on mfc dll?

How to make Win32 dll depend on mfc dll?

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++tutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kurnia Kosasi
    wrote on last edited by
    #1

    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

    A K 2 Replies Last reply
    0
    • K Kurnia Kosasi

      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

      A Offline
      A Offline
      Andrew Hain
      wrote on last edited by
      #2

      Have you tried adding mfc71.dll (in your release build) or mfc71d.dll (in your debug build) to the Ignore Specific Library (/NODEFAULTLIB) property?

      A 1 Reply Last reply
      0
      • A Andrew Hain

        Have you tried adding mfc71.dll (in your release build) or mfc71d.dll (in your debug build) to the Ignore Specific Library (/NODEFAULTLIB) property?

        A Offline
        A Offline
        Andrew Hain
        wrote on last edited by
        #3

        That should be mfc71.lib and mfc71d.lib, or mfc71u.lib and mfc71ud.lib in a wide character application.

        1 Reply Last reply
        0
        • K Kurnia Kosasi

          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

          K Offline
          K Offline
          Kurnia Kosasi
          wrote on last edited by
          #4

          Actually the NonMFCDll uses preprocessor _USRDLL. Removal of this and adding of _AFXDLL solved the problem. Thank you all.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups