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. ATL / WTL / STL
  4. conflict between ATL and MFC

conflict between ATL and MFC

Scheduled Pinned Locked Moved ATL / WTL / STL
c++help
5 Posts 4 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    I am using few classes which r derived from MFC, CMap class. When i include these files in my ATL project which is simple DLL project, i get the following error: ---------------------------------------------------------------------- mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MyProject.obj mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MyProject.obj; second definition ignored ---------------------------------------------------------------------- Can anybody suggest how i can avoid these error and wht is the reason for such an error. ksd

    K J G 3 Replies Last reply
    0
    • A Anonymous

      I am using few classes which r derived from MFC, CMap class. When i include these files in my ATL project which is simple DLL project, i get the following error: ---------------------------------------------------------------------- mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MyProject.obj mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MyProject.obj; second definition ignored ---------------------------------------------------------------------- Can anybody suggest how i can avoid these error and wht is the reason for such an error. ksd

      K Offline
      K Offline
      Kevin McFarlane
      wrote on last edited by
      #2

      As I understand it, MFC does not mix too well with ATL. I've read that it's OK to use ATL in MFC but not so good the other way round. Though in VC7 there are now a number of shared classes. Plus ATL has its own collection classes. If you're using VC7 why not investigate CAtlMap? If you're using VC6 try STL map. Of course this may not be feasible if, as it seems, you have a lot of old code that uses CMap. Kevin

      1 Reply Last reply
      0
      • A Anonymous

        I am using few classes which r derived from MFC, CMap class. When i include these files in my ATL project which is simple DLL project, i get the following error: ---------------------------------------------------------------------- mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MyProject.obj mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MyProject.obj; second definition ignored ---------------------------------------------------------------------- Can anybody suggest how i can avoid these error and wht is the reason for such an error. ksd

        J Offline
        J Offline
        Jorgen Sigvardsson
        wrote on last edited by
        #3

        If you are using VC7 you can check "Support for MFC" when you create a new ATL project. Unfortunately I don't really know what it does, so I can't help you changing the settings on your current project. -- Denn du bist, was du isst! Und ihr wisst, was es ist! Es ist mein Teil...?

        1 Reply Last reply
        0
        • A Anonymous

          I am using few classes which r derived from MFC, CMap class. When i include these files in my ATL project which is simple DLL project, i get the following error: ---------------------------------------------------------------------- mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MyProject.obj mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in MyProject.obj; second definition ignored ---------------------------------------------------------------------- Can anybody suggest how i can avoid these error and wht is the reason for such an error. ksd

          G Offline
          G Offline
          gokings
          wrote on last edited by
          #4

          I was once asked to look at why a process was taking a long time to accomplish a task. One thing the process did was load a large number of entries into a CMap. I did a bit of experimentation, and found that inserting 300,000 entries into a CMap took a bit over 4 hours. Doing 300,000 lookups on the CMap also took a bit over 4 hours. I tried an STL map, and found that inserting 300,000 entries took 22 seconds, and looking up 300,000 entries took 19 seconds. I've never had any use for CMaps. If you can, you might try switching to an STL map.

          K 1 Reply Last reply
          0
          • G gokings

            I was once asked to look at why a process was taking a long time to accomplish a task. One thing the process did was load a large number of entries into a CMap. I did a bit of experimentation, and found that inserting 300,000 entries into a CMap took a bit over 4 hours. Doing 300,000 lookups on the CMap also took a bit over 4 hours. I tried an STL map, and found that inserting 300,000 entries took 22 seconds, and looking up 300,000 entries took 19 seconds. I've never had any use for CMaps. If you can, you might try switching to an STL map.

            K Offline
            K Offline
            Kevin McFarlane
            wrote on last edited by
            #5

            Wow! That's a huge difference! Nowadays I go for STL first with new MFC code. Not that I get to do much new MFC code these days. Though sometimes, depending on the context, the MFC stuff can be more convenient, e.g., CString. Kevin

            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