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. COM
  4. MFC ATL dll link error

MFC ATL dll link error

Scheduled Pinned Locked Moved COM
helpc++comlinuxtutorial
4 Posts 2 Posters 3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Sorry guys I'm pretty new to ATL and COM stuff. The project is a shell extension with MFC support. Been looking at the tutorials on it over and over but can't find out how to fix this problem. After starting a new project I can get it to work. Then after compiling a few times (changing nothing) it ends up giving this link error. It starts happening randomly but never goes away once I first get it. Linking... mfcs42.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj) mfcs42.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj); second definition ignored Creating library ReleaseMinSize/program.lib and object ReleaseMinSize/program.exp ReleaseMinSize/program.dll : fatal error LNK1169: one or more multiply defined symbols found I can start a new project, transplant the code, and have it working for a while till I get this again. I've had to include afxcmn.h, and change my .cpp files to automatic use of precompiled headers. But apart from that I've not really changed anything. I can get the code to work fine in a nonMFC dll (without using MFC components). Removing all MFC statements I've added doesn't help either. Any idea on how to fix this? Thanks -Neil

    S 1 Reply Last reply
    0
    • L Lost User

      Sorry guys I'm pretty new to ATL and COM stuff. The project is a shell extension with MFC support. Been looking at the tutorials on it over and over but can't find out how to fix this problem. After starting a new project I can get it to work. Then after compiling a few times (changing nothing) it ends up giving this link error. It starts happening randomly but never goes away once I first get it. Linking... mfcs42.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj) mfcs42.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj); second definition ignored Creating library ReleaseMinSize/program.lib and object ReleaseMinSize/program.exp ReleaseMinSize/program.dll : fatal error LNK1169: one or more multiply defined symbols found I can start a new project, transplant the code, and have it working for a while till I get this again. I've had to include afxcmn.h, and change my .cpp files to automatic use of precompiled headers. But apart from that I've not really changed anything. I can get the code to work fine in a nonMFC dll (without using MFC components). Removing all MFC statements I've added doesn't help either. Any idea on how to fix this? Thanks -Neil

      S Offline
      S Offline
      SuperGeek
      wrote on last edited by
      #2

      Got the similar problem with MSVCRT.lib myself except my project does not link at all ;( I hope this one helps you: Look at your Project Settings -> "C/C++" tab -> "category" combo -> drop "category" combo to "Preprocessor" -> -> look at "Preprocessor definitions:" edit box. If you find _ATL_MIN_CRT, remove it for all project configurations except "Debug". This flag tells compiler not to link your project with any Microsoft Standard Runtime Libs (for minimum size). If you include "MFC support", MFC requires those runtimes linked to your project - that's where collision occurs. Since you don't have any problems while MFC's presence is disabled, that sounds like my case. Kirill.

      L 1 Reply Last reply
      0
      • S SuperGeek

        Got the similar problem with MSVCRT.lib myself except my project does not link at all ;( I hope this one helps you: Look at your Project Settings -> "C/C++" tab -> "category" combo -> drop "category" combo to "Preprocessor" -> -> look at "Preprocessor definitions:" edit box. If you find _ATL_MIN_CRT, remove it for all project configurations except "Debug". This flag tells compiler not to link your project with any Microsoft Standard Runtime Libs (for minimum size). If you include "MFC support", MFC requires those runtimes linked to your project - that's where collision occurs. Since you don't have any problems while MFC's presence is disabled, that sounds like my case. Kirill.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Thanks for the reply. I haven't got _ATL_MIN_CRT in my preprocessor definitions it seems. This is what I have: WIN32,NDEBUG,_WINDOWS,_WINDLL,_AFXDLL,_MBCS,_USRDLL,_ATL_DLL Removing _ATL_DLL doesn't seem to help. Removing _AFXDLL creates more errors ofcourse. The strange thing is I can link the project after creating a new one, and notice no differences in any project settings after it starts having this link error. I've tried deleting some different generated files but that hasn't helped so far either. Any ideas? Thanks

        L 1 Reply Last reply
        0
        • L Lost User

          Thanks for the reply. I haven't got _ATL_MIN_CRT in my preprocessor definitions it seems. This is what I have: WIN32,NDEBUG,_WINDOWS,_WINDLL,_AFXDLL,_MBCS,_USRDLL,_ATL_DLL Removing _ATL_DLL doesn't seem to help. Removing _AFXDLL creates more errors ofcourse. The strange thing is I can link the project after creating a new one, and notice no differences in any project settings after it starts having this link error. I've tried deleting some different generated files but that hasn't helped so far either. Any ideas? Thanks

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Sorry guys, fixed it now. I was using memset and including memory.h in one of my classes which seemed to cause it. Although I could comment out the memset and include statements, build it, uncomment them and build again and then it'd work. Although gives a warning: LINK : warning LNK4089: all references to "MSVCIRT.dll" discarded by /OPT:REF Which is good I guess. Can't see any options or flags that may have changed to cause this though.

          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